question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

features from POSIX conventions

See original GitHub issue
  1. I couldn’t find how to enable support of -tls equivalence to -l -s -t. i.e. grouping of flags after a hyphen.
  2. How to specify parsing of [FILE] part in example below? Or should I parse it from args before passing args to CommandLineUtils?
$>ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

Mandatory arguments to long options are mandatory for short options too.
  -a, --all                  do not ignore entries starting with .
  -A, --almost-all           do not list implied . and ..
      --author               with -l, print the author of each file
  -b, --escape               print C-style escapes for nongraphic characters

So if points above are not possible now, please consider implementing them.

See POSIX Conventions for Command Line Arguments

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
natemcmastercommented, Jul 8, 2018

Implemented in f00244246a3323743440119cabd521c5fae9e00c. You can try nightlies by using this feed: https://www.myget.org/gallery/natemcmaster/. This behavior will be enabled by default in 2.3.0 unless we detect there would be issues due to the app having short options with multiple characters. In 3.0, I’ll make short options with multiple characters an error unless you disable clustering explicitly.

1reaction
natemcmastercommented, Jul 10, 2018

Multi-character short options are not supported in clustered groups. POSIX clustering requires single letter options only. By default (i.e. you haven’t called ParserSettings.ClusterOptions = true), clustering is will be enabled if and only if there are no multi-character short option name. If you’ve explicitly enabled clustering and add a multi-character option, the library with throw an error.

Re: the -v, -vv, -vvv options. CLU will keep track of how many times NoValue options are specified. If you wanted to take advantage of clustering, you could do this instead:

var optVerbose = app.Option("-v", "Set the logging to verbose. Specify `-v` multiple times for even more verbosity", CommandOptionType.NoValue);
app.OnExecute(() => 
{
   var verboseLevel = optVerbose.HasValue()
      ? optVerbose.Values.Count
      : 0;
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

12. Utility Conventions
The following guidelines are established for the naming of utilities and for the specification of options, option-arguments, and operands. The getopt() function ......
Read more >
posix
POSIX defines both the system and user-level application programming interfaces (APIs), along with command line shells and utility interfaces, for software ...
Read more >
A Guide to POSIX | Baeldung on Linux
POSIX stands for Portable Operating System Interface. It's a family of standards specified by IEEE for maintaining compatibility among operating ...
Read more >
What is POSIX (Portable Operating System Interface)?
POSIX (Portable Operating System Interface) is a set of standard operating system interfaces based on the Unix operating system. The most recent POSIX...
Read more >
Argument Syntax (The GNU C Library)
POSIX recommends these conventions for command line arguments. getopt (see Parsing program options using getopt ) and argp_parse (see Parsing Program Options ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found