fenekku / commandeer Goto Github PK
View Code? Open in Web Editor NEWTake command of your command line in Nim
License: MIT License
Take command of your command line in Nim
License: MIT License
I would be great to be able to define a subcommand like so:
commandline:
subcommand build, ["build", "make"]:
option projectPath, string, "path", "p", "."
option targetFormat, string, "target", "t"
exitoption "help", "h", buildUsage
I.e. provide multiple names pointing to the same subcommand.
Getting commandeer.nim(114, 8) Error: undeclared identifier: 'strtabs'
as error message when trying to compile on latest version of the compiler.
I'm not sure if it makes sense to leave the bind statements in the templates, since this is the default behavior for symbol binding anyway.
This module should automatically generate the help text based on the command line interface provided and not force you to repeat yourself. Kinda the opposite of: https://github.com/docopt/docopt.nim
I have been using comandeer happily, but now need to collect multiple values of an argument. To support this, if an option is specified as:
option name, seq[type], long, short [, default]
Perhaps that could trigger the ability to receive multiple values of type?
When an argument is missing, an error is thrown. So this code guarantees that the param is provided:
commandline:
argument foo, int
But with subcommands, this is not so. This code does not guarantee that the command is specified:
commandline:
subcommand sub, "sub":
argument foo, int
One should be able to provide default values for options.
commandline:
subcommand codecmd, "code":
arguments name, string
exitoption "help", "h", codeUsage
subcommand newSecretcmd, "newSecret":
arguments newSecretName, string
exitoption "help", "h", newSecretUsage
subcommand lscmd, "ls":
exitoption "help", "h", lsUsage
exitoption "help", "h", usageHelp
$ totptool --help
Usage: totptool code <name>
This will generate a TOTP code for the given secret
name in the secret store.
Code is here. Is this intended?
commandline:
option variableA, string, "var", "v", "default"
# none of the following work
executable --var:
# out: Missing value for option 'var'
executable --var=
# out: Missing value for option 'var'
executable --var ""
# out: Couldn't convert '' to string
There should only be an error if the user hasn't explicitly given a blank value, like the following
executable --var
# out: Missing value for option 'var'
Consider the following code:
commandline:
argument path, string
option target, char, "target", "t"
Calling myapp -t t path
doesn't throw an error but doesn't do the expected thing, because path
is t
and target
is empty. The correct call is myapp -t:t path
or myapp -t=t path
.
It should either throw an error or set target
to t
in the first case.
I am using nim 0.13.0. Updating from 0.9.1 to 0.10.2 fails with:
/Volumes/Macintosh_HD/Users/shauncutts/.nimble/pkgs/commandeer-0.10.2/commandeer.nim(246, 7) Error: expression 'strtabs' has no type (or is ambiguous)
Calling context:
var appName = getAppFilename()
{.push warning[Deprecated]:off.}
commandline:
arguments paths, string, false
option verbosity, int, "verbosity", "v", 0
option bail, bool, "bail", "b", false
option tags, string, "tags", "t", nil
option defineTags, string, "define", "d", nil
exitoption "help", "h",
"\n" & """Usage: $1 [path [path ...] ]
where paths may denote ".feature" files or directories. Paths ending in
"/**" will be searched recursively for features. By default, "./features"
directory is searched.
""" % appName
{.pop.}
import commandline
commandline:
arguments(TEST, string, false)
Still expects at least one argument. Error is "Missing command line arguments".
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.