Skip to content

Instantly share code, notes, and snippets.

@gregsymons
Created January 13, 2016 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregsymons/c582a51c9b31815bd402 to your computer and use it in GitHub Desktop.
Save gregsymons/c582a51c9b31815bd402 to your computer and use it in GitHub Desktop.
How I would format the "command" example for scopt
cmd("update").
action { (_, c) => c.copy(mode = "update") }.
text("update is a command.").
children(
opt[Unit]("not-keepalive").
abbr("nk").
action { (_, c) => c.copy(keepalive = false) }.
text("disable keepalive"),
opt[Boolean]("xyz").
action { (x, c) => c.copy(xyz = x) }.
text("xyz is a boolean property"),
checkConfig { c =>
if (c.keepalive && c.xyz) failure("xyz cannot keep alive")
else success
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment