Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shon config parsing doesn't know what to do with -? #4

Open
tustin2121 opened this issue Nov 26, 2015 · 1 comment
Open

Shon config parsing doesn't know what to do with -? #4

tustin2121 opened this issue Nov 26, 2015 · 1 comment

Comments

@tustin2121
Copy link

The configuration parsing does not seem to know what to do with a non-alphanumeric option, such as -? as a short form of --help. It doesn't look like the definition for help is parsed at all in the following SSCCE:

var Command = require("shon");

var cmd = new Command("serve",{
    ip: "[--ip <ipaddr>] IP Address to serve from.",
    port: "[-p|--port <port>] :number The Port to serve from.",
    help: "[-?|-h|--help]*",
});

var config = cmd.exec();

console.log("RES", config);

if (config === "help") {
    console.log("Hello world");
    cmd._logUsage();
    process.exit(0);
    return;
}

Results:

>node server.js -?
usage: serve
  [--ip <ipaddr>] IP Address to serve from.
  [-p|--port <port>] :number The Port to serve from.
  [-?|-h|--help]*

Unexpected flag: "-?"
serve -?
      ^

>node server.js -h
usage: serve
  [--ip <ipaddr>] IP Address to serve from.
  [-p|--port <port>] :number The Port to serve from.
  [-?|-h|--help]*

Unexpected flag: "-h"
serve -h
      ^
@kriskowal
Copy link
Member

Ah, indeed. Might be able to address that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants