Questions tagged [haskell-cmdargs]

A Haskell command line parsing library

cmdargs is a commandline parser library that allows implicit deduction of command line arguments by Typeable data structures.

9 questions
9
votes
1 answer

cmdargs value arguments without equals sign

I use cmdargs to write CLI parsers for my Haskell programs. Let's assume this program, derived directly from their example: {-# LANGUAGE DeriveDataTypeable #-} import System.Console.CmdArgs.Implicit data Sample = Sample {hello :: String} deriving…
Uli Köhler
  • 13,012
  • 16
  • 70
  • 120
3
votes
1 answer

Ordered arguments with cmdargs

I would like to create a program who get some arguments with cmdargs. I would like to retrieve a list of filepath and list of actions to do. I needs these files to be taken and these actions to be perfomed in order. My arguments are declared like…
JeanJouX
  • 2,555
  • 1
  • 25
  • 37
2
votes
2 answers

haskell use file argument from command line with ".."

Using a command line parser gives a string containing a filename argument, which in this case is "../somedir". How to convert this string into a typesafe Path Rel Dir from Path to combine later with the current directory? relDir1 <- parseRelDir…
user855443
  • 2,596
  • 3
  • 25
  • 37
2
votes
1 answer

How to instruct cmdargs to not parse args beyond some point?

I am working on a program that takes another command with its arguments: $ myprog record -f 1.txt ls $ myprog record -f 1.txt ls -l Something like sudo: $ sudo ls $ sudo ls -l Here is my code that uses cmdargs: #!/usr/bin/env stack -- stack…
oshyshko
  • 2,008
  • 2
  • 21
  • 31
2
votes
0 answers

Common flags of multiple modes with cmdargs explicit

I'm writing a command line program with Haskell and cmd-args with the Explicit module. The Implicit module provide a default help message with a list of differents modes with the common flags to these modes, like this : diffy [COMMAND] ...…
JeanJouX
  • 2,555
  • 1
  • 25
  • 37
2
votes
1 answer

hidden arguments with cmdargs

I would like to use cmdargs to pass arguments to my Haskell program. For some reasons, I would like some options to be hidden (not shown but usable) in the cmdargs help message. Is there a way to do to that? I'm using cmdargs 0.10.9.
Vigo
  • 131
  • 6
2
votes
0 answers

Modify argument separator with cmdargs

I'm using cmdargs and I need to pass several values after an optionnal argument. I declared my test option to be a tuple of int : data Options = Mode1 { input :: [FilePath] , test::(Int,Int) } mode1 = Mode1 { …
JeanJouX
  • 2,555
  • 1
  • 25
  • 37
1
vote
1 answer

Mandatory arguments with cmdargs

Using cmdargs, is there a convenient way to print an error message and exit if a mandatory argument is missing? E.g. right now I have something like: foo = Foo{script = def &= args &= typ "SCRIPT"} main = do scriptName <- script <$> cmdArgs foo …
Peter
  • 2,919
  • 1
  • 16
  • 35
0
votes
1 answer

Ordered arguments with values in cmdargs

This question is an extension of the topic : Ordered arguments with cmdargs I managed to have a list of argument of the same type. But nom, I would like to have a list of options with values. like this : runhaskell ~/testargs.hs -a 5,6 -b 8,9 -c…
JeanJouX
  • 2,555
  • 1
  • 25
  • 37