cannorin / FSharp.CommandLine

A framework for building command line application in F#
Apache License 2.0
59 stars 1 forks source link

Multiline help text with indentation #9

Closed applejag closed 3 years ago

applejag commented 3 years ago

Sample

I altered the test.fsx file to try this out.

let fileOption =
  commandOption {
    names ["f"; "file"]
    description "Name of a file to use\n\
                 Default index: 0\n\
                 Look multiple lines!\n\
                 Neat!"
    takes (format("%s:%i").withNames ["filename"; "index"])
    takes (format("%s").map (fun filename -> (filename, 0)))
    suggests (fun _ -> [CommandSuggestion.Files None])
  }

I did not push those changes ^ they were just for manual testing. Would you prefer some code added for that?

Previous output

$ dotnet fsi test.fsx
test> help
num: 0
error: showing help.

usage: main [options] <command>

The main command.

commands:
  echo [options]                    Echo the input.

options:
  -n, --number=<num>                integer number.
  -v, --verbosity={q(uiet)?$|n(ormal)?$|f(ull)?$|c{ustom:<level>|:<level>}}
                                    Display this amount of information in the log.
  -f, --file=<filename>[:<index>]   Name of a file to use
Default index: 0
Look multiple lines!
Neat!
test>

New output

$ dotnet fsi test.fsx
test> help
num: 0
error: showing help.

usage: main [options] <command>

The main command.

commands:
  echo [options]                    Echo the input.

options:
  -n, --number=<num>                integer number.
  -v, --verbosity={q(uiet)?$|n(ormal)?$|f(ull)?$|c{ustom:<level>|:<level>}}
                                    Display this amount of information in the log.
  -f, --file=<filename>[:<index>]   Name of a file to use
                                    Default index: 0
                                    Look multiple lines!
                                    Neat!
test>
cannorin commented 3 years ago

Thank you very much for your contribution! Looks good to me in general. I will be doing the versioning and creating a release myself, so can you revert the last commit bumping the version?

applejag commented 3 years ago

Alright! Sure enough :)

cannorin commented 3 years ago

Thank you 😊