GithubHelp home page GithubHelp logo

argv's People

Contributors

codenothing avatar pgbiel avatar wesbos 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

argv's Issues

How to run the multiple modules in one line?

I try to put an array of modules in argv.mod(), but it doesn't work the console said :
Cannot read property 'description' of undefined.
I am new to js I can only know the mod function use some recursive call along with the option function to decompose the module object. Could anyone share how to do it? I am not sure this function is supported

【feature suggest】more colorful description and example

sometimes, we have to waring or notice user how important about the command line type.
like this:

--version
     displays version info
     xxx.js --version
--remove, -r
    remove the project --- (!important, be careful use this) <= red color
    xxx.js --remve or xxx.js -r

Repository field

This could very well be a personal choice of some sort, but I feel obliged to provide at least a little information when I get an NPM warning:

npm WARN package.json [email protected] No repository field.

If you would care to you can add repository information to your package.json:

{
  "repository": {
    "type": "git",
    "url": "https://github.com/codenothing/argv.git"
  }
}

because why not 😄

[BUG] doesn't work with spaces:

Given this code:

import argv from 'argv';

argv.option([
  { name: 'port', type: 'int' },
  { name: 'host', type: 'string' },
]);

const args = argv.run();
console.log(args);

It doesn't capture the values without an =

node bug.js --port 6969 --host 0.0.0.0
{
  targets: [ '6969', '0.0.0.0' ],
  options: { port: NaN, host: 'true' }
}

It does with with an =

node bug.js --port=6969 --host=0.0.0.0
{ targets: [], options: { port: 6969, host: '0.0.0.0' } }

But the docs shows an example using it with a space. Is there a setting I'm not seeing? Or a bug?

Avoid process exit when a wrong parameter is specified on the command line

I have a NodeJS program that uses the "argv" package.
When, in the command line, you specify a unexpected (a wrong) parameter for my program, it end its execution.
I have checked that, and I have discovered that it's because "argv" call to "process.exit".
Could you change the implementation of "agv" for making that behaviour configurable?
I believe that is a bad practice that a package calls to "process.exit"; that call sould be issued only by the main program.

Arguments with '$' characters not parsing properly

When you put two or more dollar '$' chars into an argument:

POC

#index.js
var argv = require( 'argv' );

let options = [{
    name: 'comment',
    type: 'string',
}];
var args = argv.option( options ).run();
console.log(args.options.comment);

The you do on terminal:
node index.js --comment="Hey, do you want some $$$$"

Expected result:
"Hey, do you want some $$$$"

Result:
"Hey, do you want some 114349114349"

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.