JSPM

snack-cli

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 128
  • Score
    100M100P100Q73538F
  • License Apache-2.0

command-line interfaces for node.js

Package Exports

  • snack-cli

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (snack-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build Status Code Coverage NPM Repo License

SNACK-CLI is command-line interfaces for node.js

Install by npm

npm install snack-cli

Example

var cli = require('snack-cli');

var argv = cli
    .name('sftp')
    .version('1.0.0-beta')
    .usage('[options] local remote')
    .description('An sftp application written by node.js')
    .option('    --host <host>', 'remote ssh hostname/ip')
    .option('    --port <port>', 'remote ssh port', '22', cli.transformers.asInt)
    .option('-u, --username <user>', 'username for authentication', 'root')
    .option('-p, --password <pass>', 'password for authentication')
    .option('    --auto-mkdirs', 'mkdirs when dir not found')
    .allowArgumentCount(2)
     //.allowUnknownOption()
     //.allowMissingRequiredOption()
    .parse();

console.log(argv);

When you execute following cli:

sftp --host 192.168.0.254 -p 111111 --auto-mkdirs ./1.txt /tmp/1.txt

You will get:

{
    'host': '192.168.0.254',
    'port': 22,
    'username': 'root',
    'password': '111111',
    'autoMkdirs': true,
    'args': [
        './1.txt',
        '/tmp/1.txt'
    ]
}

Output help

When you execute following cli:

sftp --help

You will get:

Usage: sftp [options] local remote

An sftp application written by node.js

Options:
      --host <host>       remote ssh hostname/ip
      --port <port>       remote ssh port (default: 22)
  -u, --username <user>   username for authentication (default: root)
  -p, --password <pass>   password for authentication
      --auto-mkdirs       mkdirs when dir not found
      --version           display version information and exit
      --help              display this help and exit

License

Released under the Apache 2 License.