Socket
Socket
Sign inDemoInstall

cmdln

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cmdln - npm Package Versions

1234

1.2.2

Diff

Changelog

Source

1.2.2

  • Fix {{name}}-replacement in subcmd help templates: all {{name}} usages are replaced. Change from using the subcommand name as the value of {{name}} to the tool name (i.e. the top-level command name).
trentm
published 1.2.1 •

Changelog

Source

1.2.1

  • Pass the subcmd back as the second arg in the <cli>.main callback. This enabled the subcmd to be quoted in an error message if there was an err returned. E.g.:

      var cli = new Mo();
      cli.main(process.argv, function (err, subcmd) {
          if (err) {
              var subcmdStr = subcmd ? ' ' + subcmd : '';    // <---- HERE
              if (err.body && err.body.code) {
                  console.error('%s%s: error (%s): %s', cli.name, subcmdStr,
                      err.body.code, err.message);
              } else {
                  console.error('%s%s: error: %s', cli.name, subcmdStr,
                      err.message);
              }
              if (cli.opts.verbose && err.stack) {
                  console.error('\n' + err.stack);
              }
              process.exit(1);
          } else {
              process.exit(0);
          }
      });
    
trentm
published 1.2.0 •

Changelog

Source

1.2.0

  • [Backward incompatible change] Underscores in sub-command do_* methods are translated to hyphens for the sub-command name. This means you can have sub-commands with hyphens, at the cost of not allowing underscores.

    A sub-command method like this:

      MyCmdln.prototype.do_foo_bar
    

    results in a 'foo-bar' sub-command.

    Shout if this breaks you. I could see about making this configurable.

trentm
published 1.1.4 •

Changelog

Source

1.1.4

  • Update to dashdash 1.3.2: fix a subtlety with an option using all of type: 'bool', default and env (IOW, rare).
trentm
published 1.1.3 •

Changelog

Source

1.1.3

  • Update to dashdash 1.3.1: fix 'env' not working for options with a 'default'.
trentm
published 1.1.2 •

Changelog

Source

1.1.2

trentm
published 1.1.1 •

Changelog

Source

1.1.1

  • Update to dashdash 1.2.0: envvar integration, '--dry-run' -> opts.dry_run.
trentm
published 1.1.0 •

Changelog

Source

1.1.0

  • Add cmdln.main for simpler mainline usage, e.g.:

      function MyTool() {
          // ...
      }
      util.inherits(MyTool, cmdln.Cmdln);
    
      // ...
    
      if (require.main === module) {
          cmdln.main(MyTool);
      }
    
  • Drop support for 'help_FOO' help commands. Not worth the complexity.

  • Allow custom options given in constructor and a Cmdln.prototype.init hook that is called to handle the top-level options after they are parsed out and before subcmd dispatch. See "examples/conan.js" for an example.

  • Top-level options are put on this.opts for use by subcmds.

trentm
published 1.0.2 •

Changelog

Source

1.0.2

trentm
published 1.0.1 •

Changelog

Source

1.0.1

  • Fix for a subcmd calling do_help on itself.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc