Coder Social home page Coder Social logo

vantage's Introduction

hey there


I'm the Co-Founder & CTO at MindCloud, a rapidly growing B2B startup in the integration space. I've been writing production software for 16 years with an emphasis on designing and building data-heavy platforms from the ground up.

You can follow me on Twitter.


I had fun building some original OSS projects in the past for the Node community:

  • Vorpal - Interactive CLI framework for Node
  • Cash - Cross-platform unix coreutils in Javascript
  • Vantage - Distributed, realtime CLI for live Node apps

vantage's People

Contributors

bradenoguinn avatar brollb avatar davemackintosh avatar dthree avatar e-jigsaw avatar eiriksm avatar emgee3 avatar emilkje avatar enykeev avatar fiznool avatar joe-adams avatar ryan-mcbride avatar thaumant avatar zakhenry 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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vantage's Issues

Can't get auth to work

No matter what I did, including trying out the builtin basic auth mechanism, vantage seems to bypass the authentication every time. For example, the following code results in a successful connection:

const Vantage = require('vantage');

Vantage()
  .delimiter('demo~$')
  .auth(function(vantage, options) {
    return function(args, cb) {
      cb('Nope', false);
    }
  })
  .listen(3001);
$ vantage 3001

I tried both on local machine, and on another machine on the same network.
I am currently using version 1.5.2

connections should be transparent

Piping stdout downstream.

Perhaps there's a good use-case for this but by default it would be nice if connecting from a remote did nothing but connect up the repl. If someone wants to suck the stdout into their connected client, then they could make a command for that (or you could make it a standard built-in command).

In addition, it probably shouldn't redirect output totally, rather it should just duplicate the output.

Unnecessary dependency: npm

It seems to me that having "npm" in the package as a dependency is not needed, and adds about 20Megs to the node_modules folder.

Persistent history

Command history is handy, but it doesn't live beyond a session. It would be awesome if vantage had persistent history. As of now, this can only be achieved by loading entries into vagrant.session._hist.

History could be kept server-side on a per-user basis, or client-side on a per-host basis.

For a server-side implementation, instead of bundling this functionality with vantage itself, a public history API could be exposed for extensions to manage and provide history, with session history as the default implementation.

A client-side implementation could provide a vantage command-line flag to pick a history file, defaulting to something like ~/.vantage/history/<host> (for system-wide, per-host history) or ./vantage/history (for directory-based history).

Connect by domain name

Hi,

I tried to connect remote server with vantage

$ vantage some.domain.com:3000

then vantage showed Invalid server/port passed error. I checked code https://github.com/dthree/vantage/blob/master/bin/vantage.js#L46 . This only passed x.x.x.x style ip. So I changed code below

  var valid = (isNaN(connection.port))
    ? ("\n  Invalid server/port passed: " + connection.server + ":" + connection.port + "\n")
    : true;
  return valid;

And re-run

$ vantage some.domain.com:3000
Connecting to some.domain.com:3000 using http...
$ 

It works.

Could you remove that validator? or do you have any reason about that validator?

Thanks

SyntaxError: Unexpected strict mode reserved word

vantage 1.3.6
running app from .bin I get:

node_modules/vantage/lib/util.js:62
let arrClone = _.clone(arr);
^^^
SyntaxError: Unexpected strict mode reserved word
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)

any hints?

Allow banner to be a function so banner can change depending on app state, or environment state

Currently, the banner is assigned on boot:

var banner = 
"######################################################################" + 
"#                    Welcome to joescrabshack.com                    #" + 
"#                                                                    #" +
"#              All connections are monitored and recorded            #" + 
"#      Disconnect IMMEDIATELY if you are not an authorized user      #" + 
"######################################################################";
vantage
  .delimiter('appsvr:3000~$')
  .banner(banner)
  .listen(3000);

However this means that the context can only be when the banner was registered.

Instead, if the api could accept a banner, ie

vantage
  .delimiter('appsvr:3000~$')
  .banner(() => {
    if (process.stdout.columns < 70){
      return;
    }
    return banner;
  })
  .listen(3000);

Then the banner could be changed depending on the app state, or environment state. Some benefiting examples

  • process.stdout.columns could be inspected to hide/resize wide banners (this currently only works if the same size shell as what booted the app in the first place is used)
  • status of the running application could be returned, maybe a list of the last X exceptions
  • Notifications that migrations need to be run
    etc

Can't execute tour after 1.4.0 release

On OSX with node 0.12.7 and vantage 1.5.0 I get this:

$ npm install -g vantage
    $ vantage tour
tour~$

/Users/zmarouf/.nvm/versions/node/v0.12.7/lib/node_modules/vantage/node_modules/vorpal/lib/ui.js:236
    this._activePrompt.clean();
                       ^
TypeError: undefined is not a function
    at Object.ui.pause (/Users/zmarouf/.nvm/versions/node/v0.12.7/lib/node_modules/vantage/node_modules/vorpal/lib/ui.js:236:24)
    at Object.ui.log (/Users/zmarouf/.nvm/versions/node/v0.12.7/lib/node_modules/vantage/node_modules/vorpal/lib/ui.js:335:23)
    at Vorpal.vorpal.log (/Users/zmarouf/.nvm/versions/node/v0.12.7/lib/node_modules/vantage/node_modules/vorpal/lib/vorpal.js:274:15)
    at Function.Logger.log.br (/Users/zmarouf/.nvm/versions/node/v0.12.7/lib/node_modules/vantage/lib/logger.js:136:12)
    at Object.steps.step1 (/Users/zmarouf/.nvm/versions/node/v0.12.7/lib/node_modules/vantage/examples/tour/tour.js:67:9)
    at Object.<anonymous> (/Users/zmarouf/.nvm/versions/node/v0.12.7/lib/node_modules/vantage/examples/tour/tour.js:281:7)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)

With version 1.4.0:

$ vantage tour
module.js:338
    throw err;
          ^
Error: Cannot find module './../../lib/util'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/zmarouf/.nvm/versions/node/v0.12.7/lib/node_modules/vantage/examples/tour/tour.js:15:12)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)

With version 1.3.12

$ vantage tour

  ## 1. To start, press [enter] 3 times.

tour~$

So I looked into things a little and it seems that vorpal 1.0.3 breaks things.
Setting the dependency to 1.0.2 fixes things as far as the tour is concerned except for your hacker-news-example.
I get this:

use vantage-hacker-news
Installing vantage-hacker-news from the NPM registry:
runTopLevelLifecycles     ▀ ╢█████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
Error downloading module:

and the option is not visible in the 'help' menu.

I hope that helps with your investigations.

Vantage Command Missing Number Data

in vantage i input the following command:

$ start test 1111111112312345425
{ options: {}, platform: 'test', uid: 1111111112312345500 }

1111111112312345425 missing the ending data 1111111112312345500 ???

1111111112312345425
1111111112312345500

i have tried the newest version "commander". it hasn't this bug. is this vantage bug?

More explanation?

I'm intrigued... but I don't get it. What exactly is this for? I get comander.js, but this lib somehow exposes a cli to my existing app in production? I'm not sure I get it. :(

Listen callback does not fire until first connection

When using vantage in standalone mode, the listen callback does not fire until I connect to it with the command line client.

var Vantage = require('vantage');
var vantageServer = new Vantage();

vantageServer
  .delimiter('$')
  .listen(2001, function() {
    console.log('Started vantage server at http://localhost:2001');
  });

Frozen caret/pointer/cursor.

With:

  • Node v4.0.0
  • Vantage 1.5.1

Below I typed foo with everything going fine...
type_text
...I then click the left arrow three times, all the while the caret/pointer/cursor remained still. Whenever I press a key, the input appears where I'd expect but the caret/pointer/cursor remains at the end.

type_text2

I hope the development with this and Vorpal is working out!

Command arg parsing producing wierd results

Not sure if I misunderstood the command arguments - I would like a command with one mandatory arg and one optional. And another command with 2 optional args.

Using

.command('load <must> [maybe]')

The command becomes:

load <must>

and the args passed to parseExpectedArgs are:

[ '[maybe]' ]

In the second instance

.command(load [maybe] [maybe2])

The command becomes

load

and the args passed to parseExpectedArgs are:

[ '[maybe] ', 'maybe2]' ]

notice the missing bracket.

Matt

several build errors

Getting these when installing vantage,

utf-8-validate

$ if not defined npm_config_node_gyp (node "C:\Users\loote\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  bufferutil.cc
C:\projects\vantage-test\node_modules\nan\nan.h(263): error C2995: 'v8::Local<T> _NanEnsureLocal(v8::Local<T>)': function template has already been defined [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
  C:\projects\vantage-test\node_modules\nan\nan.h(256): note: see declaration of '_NanEnsureLocal'
C:\projects\vantage-test\node_modules\nan\nan.h(661): error C3083: 'smalloc': the symbol to the left of a '::' must be a type [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
C:\projects\vantage-test\node_modules\nan\nan.h(661): error C2039: 'FreeCallback': is not a member of 'node' [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
  C:\Users\loote\.node-gyp\5.7.0\include\node\node_object_wrap.h(8): note: see declaration of 'node'
C:\projects\vantage-test\node_modules\nan\nan.h(661): error C2061: syntax error: identifier 'FreeCallback' [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
C:\projects\vantage-test\node_modules\nan\nan.h(665): error C2065: 'callback': undeclared identifier [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
C:\projects\vantage-test\node_modules\nan\nan.h(665): error C2065: 'hint': undeclared identifier [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
C:\projects\vantage-test\node_modules\nan\nan.h(672): error C2665: 'node::Buffer::New': none of the 4 overloads could convert all the argument types [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
  C:\Users\loote\.node-gyp\5.7.0\include\node\node_buffer.h(43): note: could be 'v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate *,char *,size_t)'
  C:\Users\loote\.node-gyp\5.7.0\include\node\node_buffer.h(31): note: or       'v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate *,v8::Local<v8::String>,node::encoding)'
  C:\projects\vantage-test\node_modules\nan\nan.h(672): note: while trying to match the argument list '(v8::Isolate *, const char *, uint32_t)'
C:\projects\vantage-test\node_modules\nan\nan.h(676): error C2440: 'return': cannot convert from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object>' [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
  C:\projects\vantage-test\node_modules\nan\nan.h(676): note: No constructor could take the source type, or constructor overload resolution was ambiguous
C:\projects\vantage-test\node_modules\nan\nan.h(683): error C2039: 'Use': is not a member of 'node::Buffer' [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
  C:\Users\loote\.node-gyp\5.7.0\include\node\node_buffer.h(8): note: see declaration of 'node::Buffer'
C:\projects\vantage-test\node_modules\nan\nan.h(683): error C3861: 'Use': identifier not found [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
gyp ERR! build error

bufferutil

$ if not defined npm_config_node_gyp (node "C:\Users\loote\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  bufferutil.cc
C:\projects\vantage-test\node_modules\nan\nan.h(263): error C2995: 'v8::Local<T> _NanEnsureLocal(v8::Local<T>)': function template has already been defined [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
  C:\projects\vantage-test\node_modules\nan\nan.h(256): note: see declaration of '_NanEnsureLocal'
C:\projects\vantage-test\node_modules\nan\nan.h(661): error C3083: 'smalloc': the symbol to the left of a '::' must be a type [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
C:\projects\vantage-test\node_modules\nan\nan.h(661): error C2039: 'FreeCallback': is not a member of 'node' [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
  C:\Users\loote\.node-gyp\5.7.0\include\node\node_object_wrap.h(8): note: see declaration of 'node'
C:\projects\vantage-test\node_modules\nan\nan.h(661): error C2061: syntax error: identifier 'FreeCallback' [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
C:\projects\vantage-test\node_modules\nan\nan.h(665): error C2065: 'callback': undeclared identifier [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
C:\projects\vantage-test\node_modules\nan\nan.h(665): error C2065: 'hint': undeclared identifier [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
C:\projects\vantage-test\node_modules\nan\nan.h(672): error C2665: 'node::Buffer::New': none of the 4 overloads could convert all the argument types [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
  C:\Users\loote\.node-gyp\5.7.0\include\node\node_buffer.h(43): note: could be 'v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate *,char *,size_t)'
  C:\Users\loote\.node-gyp\5.7.0\include\node\node_buffer.h(31): note: or       'v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate *,v8::Local<v8::String>,node::encoding)'
  C:\projects\vantage-test\node_modules\nan\nan.h(672): note: while trying to match the argument list '(v8::Isolate *, const char *, uint32_t)'
C:\projects\vantage-test\node_modules\nan\nan.h(676): error C2440: 'return': cannot convert from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object>' [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
  C:\projects\vantage-test\node_modules\nan\nan.h(676): note: No constructor could take the source type, or constructor overload resolution was ambiguous
C:\projects\vantage-test\node_modules\nan\nan.h(683): error C2039: 'Use': is not a member of 'node::Buffer' [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
  C:\Users\loote\.node-gyp\5.7.0\include\node\node_buffer.h(8): note: see declaration of 'node::Buffer'
C:\projects\vantage-test\node_modules\nan\nan.h(683): error C3861: 'Use': identifier not found [C:\projects\vantage-test\node_modules\bufferutil\build\bufferutil.vcxproj]
gyp ERR! build error

Info

Windows 10
node v5.7.0
npm 3.3.3
vantage @1.5.2

Problem with exit command

When I set a simple standalone server, and try to connect to it with the vantage command line, the exit command breaks. It prints exit twice, but I only typed it once.

// Code
var vantageServer = vantage()
vantageServer.banner('Hello World');
vantageServer.listen(5111);
console.log('Vantage server started on port 5111');

// Error
Connecting to 127.0.0.1:5111 using http...
local@makawao~$ exit
local@makawao~$ exit
local@makawao~$ Prompt called when mid prompt...

/home/giodamelio/.nvm/versions/node/v4.0.0/lib/node_modules/vantage/node_modules/vorpal/lib/ui.js:130
      throw new Error('UI Prompt called when already mid prompt.');
      ^

Error: UI Prompt called when already mid prompt.
    at Object.ui.prompt (/home/giodamelio/.nvm/versions/node/v4.0.0/lib/node_modules/vantage/node_modules/vorpal/lib/ui.js:130:13)
    at EventEmitter.vorpal.prompt (/home/giodamelio/.nvm/versions/node/v4.0.0/lib/node_modules/vantage/node_modules/vorpal/lib/vorpal.js:457:8)
    at EventEmitter.vorpal.exit (/home/giodamelio/.nvm/versions/node/v4.0.0/lib/node_modules/vantage/node_modules/vorpal/lib/vorpal.js:1032:12)
    at CommandInstance.<anonymous> (/home/giodamelio/.nvm/versions/node/v4.0.0/lib/node_modules/vantage/node_modules/vorpal/lib/vorpal-commons.js:48:19)
    at EventEmitter.session.execCommandSet (/home/giodamelio/.nvm/versions/node/v4.0.0/lib/node_modules/vantage/node_modules/vorpal/lib/session.js:412:24)
    at EventEmitter.vorpal._exec (/home/giodamelio/.nvm/versions/node/v4.0.0/lib/node_modules/vantage/node_modules/vorpal/lib/vorpal.js:767:18)
    at EventEmitter.vorpal._execQueueItem (/home/giodamelio/.nvm/versions/node/v4.0.0/lib/node_modules/vantage/node_modules/vorpal/lib/vorpal.js:607:10)
    at EventEmitter.vorpal._queueHandler (/home/giodamelio/.nvm/versions/node/v4.0.0/lib/node_modules/vantage/node_modules/vorpal/lib/vorpal.js:591:10)
    at Socket.<anonymous> (/home/giodamelio/.nvm/versions/node/v4.0.0/lib/node_modules/vantage/lib/client.js:236:37)
    at Socket.Emitter.emit (/home/giodamelio/.nvm/versions/node/v4.0.0/lib/node_modules/vantage/node_modules/socket.io-client/node_modules/component-emitter/index.js:134:20)

TypeError: vantage._pause is not a function

After I've fixed the #67 error when I connect to a server via vantage client, I get an error printed to the client console :

(node:19581) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: vantage._pause is not a function

I've not found the actual code that causes this error.

Vantage version: 1.7.0
Node: 6.8.0

Release a new package

Currently the latest version on npm & in package.json is 1.7.0, however there has been a few merges into master since then. I would suggest next version should be 1.8.0 as it will include the bump to the latest vorpal, however I haven't encountered any breaking changes

tutorial not working on windows

Step 5: start server 3001
Successfully spawned server

Step 6: vantage 3001
Error connecting. 503 service unavailable

You're in. Notice the prompt changed.

(Prompt does not change)

Step 7: port
undefined

An extrenal process is spawned but it does not repond. Any idea what's causing this?

SyntaxError with strict mode

Hi, I'm trying to use vantage but when I require the lib in my code I get this error :

[...]/node_modules/vantage/lib/vantage.js:766
    function parseArgsByType(arg, cmdArg) {
    ^^^^^^^^
SyntaxError: In strict mode code, functions can only be declared at top level or immediately within another function.
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/home/halfman/beam.io/server.js:6:15)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

Here is my environment :

$ uname -srvo
Linux 3.19.0-25-generic #26-Ubuntu SMP Fri Jul 24 21:17:31 UTC 2015 GNU/Linux

$ npm --versions
{ 'beam.io': '0.0.0',
  npm: '2.11.3',
  http_parser: '2.3',
  modules: '14',
  node: '0.12.7',
  openssl: '1.0.1p',
  uv: '1.6.1',
  v8: '3.28.71.19',
  zlib: '1.2.8' }

Note : I also get the same error if I type "vantage" in console.

Thanks for your help.

Duplicate client connections on server restart (resulting in duplicate console output)

Hi,

If the vantage server restarts while client sessions are connected, the client(s) reconnect and then display duplicate output in response to any commands. E.g:

Webapp~$ help

Commands:

    help [command]              Provides help for a given command.
    exit [options]              Exists instance of Vantage.
    vantage [options] [server]  Connects to another instance of Node running Vantage.
    use [options] <module>      Installs a vantage extension in realtime.

*** SERVER RESTART HERE ***
Webapp~$ help

Commands:

    help [command]              Provides help for a given command.
    exit [options]              Exists instance of Vantage.
    vantage [options] [server]  Connects to another instance of Node running Vantage.
    use [options] <module>      Installs a vantage extension in realtime.


  Commands:

    help [command]              Provides help for a given command.
    exit [options]              Exists instance of Vantage.
    vantage [options] [server]  Connects to another instance of Node running Vantage.
    use [options] <module>      Installs a vantage extension in realtime.

Webapp~$

Further restarts result in additional duplication.
Any suggestions on how to resolve this? Thanks.

Can’t use `.types`

The Readme says:

Vantage is an extension of Vorpal, and so inherits all of its properties and methods.

However, I don’t seem to be able to use vorpal’s types method as specified here:

TypeError: vantage.command(...).description(...).types is not a function

Repeated output

when you run the simple example like
var vantage = require("vantage")();

// Add the command "foo", which logs "bar".
vantage
.command("foo")
.description("Outputs 'bar'.")
.action(function(args, callback) {
this.log("bar");
callback();
});

vantage
.delimiter("websvr~$")
.listen(5003)
.show();

and you type foo, you get foo repeated then bar. Why is foo repeating?
websvr~$ foo
websvr~$ foo (this is the repeated output)
bar

Maximum of 2 arguments?

I've just spent an hour trying to figure out why the 3rd argument of my command was not reaching the action function.

Eventually found this line:

vantage.j:787    var supportedArgs = 2;

Changed it, and voilá.

Is there a reason for this? The Command custructor will happily take more arguments, and the help command lists them, even though they are ignored.

It's limiting and very confusing

support more than one parameter

I've tried to create a command with more than one parameters however the library seems not to support it.

code:

vantage
  .command('dbs create <name> <username> <password>', 'creates database')
  .action(require('./cmds/dbs-create'));

help output:

    dbs create <name>>  creates database

action args:

[{ options: {}, 'name>': 'a' }]

Doesn't work with Node 4 yet

I'd probably just say it on the chat if I could get on from work, but I accidentally found that it doesn't work with Node 4. There are node-gyp problems.

Express + socket.io

Hi, Is there any way to make vantage work with express + socket.io?

Thanks in advance.

vantage-auth-basic missing

It looks like the repository no longer exists, and the pam repository is abandoned. I plan on implementing public / private-key authentication of my own, would you be interested in a repository link once it's done to add to the readme?

start boot

hi,
i want start my app when my raspi boot, i use this https://github.com/chovy/node-startup

but this doesn't work and i don't understand why, no error message, no log.

Boot PI, connect to ssh, and launch vantage 8080, and error 503

Thanks

Two arguments to command() produces "vantage.command(...).option is not a function"

If you supply a second argument to .command(), it returns the vantage instance rather than the command instance.

The following example from the readme produces an error:

TypeError: vantage.command(...).option is not a function

const Vantage = require('vantage')
const vantage = new Vantage()

vantage
  .command('order pizza [type]', 'Orders a type of food.')
  .option('-s, --size <size>', 'Size of pizza.')
  .option('-a, --anchovies', 'Include anchovies.')
  .option('-p, --pineapple', 'Include pineapples.')
  .option('-o', 'Include olives.')
  .option('-d, --delivery', 'Pizza should be delivered')
  .action(function(args, cb){
    console.log(args);
    cb();
  });

It seems this is done intentionally:

if (desc) return this;

vantage.command = function(name, desc, opts) {
  ...
  if (desc) return this;
  return cmd;
};

As this came in with the initial commit, I can't deduce as to why.

listen should take a callback

.listen should take a callback as optional last argument, in the same way net/http server.listen(port, cb) does so you know if and when the server bound to the port.

Support multiple HapiJS connections

Hapi has support for multiple connections and no connections at all (like examples/hapi/hapi.js), I see three branches of operation here.

  1. Create a connection for Socket.IO to hook onto if no connections are present
  2. use Hapi labels to label connections and select an appropriate one when creating the Socket.IO server.
  3. Use a single connection if only one is present.

Improve/correct project description

The readme/description of the project could/should be described better. In particular, all of the references to SSH should be replaced with something else as this project does not actually use SSH at all and IMHO can cause confusion. Perhaps "interactive shell" or "interactive session" or "command prompt" or "shell prompt" or similar would be more accurate descriptions of what the project provides.

Web client

Hi,
congratulations for this very nice project !
I would like to know if a web client was planned. If not, have you any recommandations to start making one ?

Expose delimiter to commander?

Allows for later change delimiter in the process of a command. Similarly, it'd good to expose all other run-time related system variables for more featured plugins.

Say, it would be awesome to replace the delimiter after a login?

child process

What is the right way to start another process from within vantage and return to the vantage prompt when the process is terminated via ^C?

Suppress internal logs

Need a way to disable these types of messages:

User entering session.
Piping stdout downstream.
Stdout returned to console.
User exited session.

Command arguments

The documentation for command arguments seems to be severely lacking,

It took a while for me to realize that the .command() function takes some sort of DSL to manage arguments.

And on top of that they don't support quoted strings or something, or perhaps that's more lack of documentation.

In any event it might be helpful to include command argument processing in the simple basic example that's plastered in the readme and pops up everywhere I do a google search

ReferenceError: Promise is not defined on Windows 8.1

After create a simple js

var Vantage = require('vantage');
var server = new Vantage();

server
  .command('foo')
  .description('Outputs "bar".')
  .action(function(args, cb) {
    console.log('bar');
    cb();
  });

server
  .delimiter('webapp~$')
  .listen(80)
  .show();

And try to execute: node .\countdownSet.js

an error is display:

  Error: Cannot find module 'vantage'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\Users\ridermanb\Projects\countdownSet\countdownSet.js:1:81)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)

So I try to execute a simple vantage, and again, a new error is display:

ReferenceError: Promise is not defined
    at VantageClient.vantageClient.connect (C:\Program Files\nodejs\node_modules\vantage\lib\client.js:49:14)
    at Vantage.vantage.connect (C:\Program Files\nodejs\node_modules\vantage\lib\vantage.js:253:30)
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\vantage\bin\vantage.js:66:26)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

Yes, I install it using npm install -g vantage

1.4.0 remote connection seem to be broken

Had a code work fine 1.3.5

Deploy and pull vantage 1.4.0 connect don't fail and do get events for connection but don't get prompt and cannot send commands.

Downgrade to 1.3.5 fixed the problem.

Best way to asynchronously logs to Vantage?

Hi,

I wanted to make a debug as we can see in the Gif.
So, using express, I started by making a middleware to get all requests information but now I'm asking myself on how to properly send theses logs to my vantage instance.

I thought that I can send the log function of my debug command to the global scope (then the middleware can use it to log everything he has to) but I find this very crappy.

Thanks for your councils.

Update to latest vorpal

I may be missing something, but it seems that the version of vorpal that vantage depends on is way out of date (389 commits?! dthree/vorpal@31e079c...c987b51).

Is this really the case? And if so can the upgrade be made as there is a lot of missing functionality (autocomplete, validation etc)

Loving both projects but need to use vantage to be able to drop into runtime shell.

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.