Code Monkey home page Code Monkey logo

commandpost's People

Contributors

cdibbs avatar dkushner avatar esrefdurna avatar moshensky avatar vvakame avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

commandpost's Issues

Options get confused if the value is the same as a subcommand

In the fly CLI, we have a command named test (like fly test).

We also have a "global" option to specify and environment -e, --env <value>.

The issue is if you do fly -e test other_command, commandpost thinks test is the command, not the value of the env option.

Root description never displayed.

I have been hard-pressed to get the text passed into description to display:

            let root = commandpost
                .create<any, any>("")
                .version(this.pkg.version, "-v, --version")
                .description("This is a fancy program that does neat things.");
               // ...
            commandpost
                .exec(root, this.process.argv);

Am I doing something wrong? Thanks!

Accept mapping function in option(...)

I'd like to do some parsing of a string option before it gets to my runner method. Right now, this requires that I create an interface to accept the string list, then a second interface to hold the parsed result. I'd like some way of passing a function to mapper with the signature (values: string[]) => T, and have that function called before the action is invoked.

Typescript error

I am getting the following error:

TypeScript error: node_modules/commandpost/index.d.ts(1,15): Error TS2307: Cannot find module './lib'.

When compiling a project that has indirect dependencies on commandpost. Is it possible to express this path in a different way? I am not sure it is a commandpost issue, but I have no idea of how to get rid of it otherwise.

Way to receive commands in any order.

Is there any way to receive commands in any order? For example, it would be nice to be able to do something like this:

$ node index.js --port 1234 server --uglify -inspect

Currently only this works:

$ node index.js server --port 1234 --uglify --inspect

Allow root options to be passed into subcommand

Commandpost doesn't allow the user to pass a root option AFTER the subcommand.

For example, if I have a root option --user and a subcommand download, then it needs to be passed like this:

$ myapp --user me download # Works

But it would be great if the user could do this instead:

$ myapp download --user me # Currently Fails

It seems fairly common to allow the command to come first (like in git and commander). Could you please allow this in commandpost too?

Required parameter error messages

Is it possible to setup a callback for missing required parameters? Right now, it shows a stack trace, by default. I would have to catch and parse the error message if I wanted something custom, right?

If this doesn't exist, my hope would be for something like this:

            let newTemp = root
                .subCommand<INewCmdOpts, INewCmdArgs>("new <item>")
                .description("Generate a thing from an item.")
                .option("-n, --name <name>", "a description")
                .optionError((oName, errType, defaultMsg): string => customMessageIfAny)
                .commandError((cName, errType, defaultMsg): string => customMessageIfAny);

Thanks in advance.

Expose models to import

Could you please expose the Command (and any other publicly-usable model) to import? I wouldn't mind something like this:

import * as cp from 'commandpost';

setupOneCmd(): cp.Command {
  // make and return a cp.Command
}

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.