Skip to content

How would I add something like a "--version" argument to a program? #339

Answered by bkirwi
nessus42 asked this question in Q&A
Discussion options

You must be logged in to vote

So, two answers:

let programOpts = ??? // your normal program options go here
let versionOpts = Opts.flag("version", "Print version information and exit").map(_ => println("Version 1.0"))
let opts = programOpts orElse versionOpts

CommandApp's version flag is actually implemented like this under the hood.

Many people st…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nessus42
Comment options

Answer selected by nessus42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants