Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Mar 04 19:33
    HolySuicidalTurkey commented #127
  • Feb 15 18:14
    jeremygiberson-at-privoro commented #292
  • Feb 15 18:12
    jeremygiberson-at-privoro commented #292
  • Feb 15 18:12
    jeremygiberson-at-privoro commented #292
  • Feb 15 18:11
    jeremygiberson-at-privoro commented #292
  • Feb 03 21:27
    reiser commented #343
  • Dec 04 2020 20:04
    DominicChm commented #352
  • Nov 28 2020 15:23
    HugoPoi commented #331
  • Nov 02 2020 01:32
    paul-qamaestro commented #42
  • Nov 02 2020 01:31
    paul-qamaestro commented #42
  • Nov 02 2020 01:31
    paul-qamaestro commented #42
  • Nov 02 2020 00:29
    paul-qamaestro commented #42
  • Oct 30 2020 00:33
    slinkardbrandon commented #332
  • Oct 29 2020 15:37
    macrozone commented #332
  • Oct 29 2020 15:35
    macrozone opened #352
  • Oct 29 2020 14:48
    sweethuman commented #332
  • Oct 29 2020 14:45
    macrozone commented #332
  • Oct 20 2020 15:01
    drodenberg commented #331
  • Oct 07 2020 10:45
    Michelle99798 closed #351
  • Oct 07 2020 02:34
    Michelle99798 opened #351
Stramaz
@stramaz_twitter
Yes, something like this. For example, I run via vorpal command a bot (ie: a trading bot), a service in background, later on I can run again the vorpal application and interact with that service running other vorpal commands (see stats, check progress, stop bot, change configuration, restart it)
Jens Kallup
@paule32
hello#
how can i embed vorpal in website?
Graham Holden
@TripeHound
Just started using Vorpal and got the basics in place... node myapp.js will open an interactive session and prompt for commands; node myapp.js mycmd myarg will run a command and return to the command-prompt. Is there a way of giving one or more commands on the command-line and then switching to accepting commands interactively? At the moment, after command-definition, I've got vorpal.parse( process.argv ).show() ;. TIA
Reservjesus
@grouchexmachina_twitter
So how dead is vorpal.js? Or is there a viable fork somewher
Robert Kraig
@robertkraig
is it possible to write a vorpal cli without being stuck in the event loop? like.. node cli.js mycommand:name --argument
Nokko
@nok-ko
hrrgh. why do my commands uh, say their name?
[nodemon] starting `node index.js`
listening on port 3000
op$ help
op$ help

  Commands:

    help [command...]  Provides help for a given command.
    exit               Exits application.
    say <message>      Sends a `serverchat` to the connected clients.

op$
the second help isn't me typing it in
eugh
Katharsis
@yakuzadave
Quick question. I was looking to have the commands separated into their own files and stored in a "commands" folder. Has anyone found a good way to do this?
Katharsis
@yakuzadave
Never mind, I figured out an easy way. Just used require-all and _.forOwn with vorpal.use
const commands = require('require-all')(__dirname + '/commands');
const _ = require("lodash")
_.forOwn(commands, function(value, key) {
  vorpal.use(value)
});
Joe Pea
@trusktr
Does Vorpal not have a way to do that automatically based on the command specified via the CLI? (I'm new here). Importing all the commands all at once is less performant than just importing the specific command that the user wants to execute. It will evaluate all the modules instead of just one. With various alternatives to Vorpal (commander.js, Caporal, sywac, etc) I've noticed much speed up in just importing specific modules only.
@yakuzadave ^
Katharsis
@yakuzadave
Well, I thought that I could do vorpal.use(commands) but it wasn't liking that way, so I used this method and it requires much less setup.

each command just follows this format:

module.exports = function(vorpal, options){
    // insert vorpal command here
}
was following this bit of the docs as a guide:
https://github.com/dthree/vorpal/wiki/Docs-%7C-Creating-Extensions
Ido Samuelson
@isamuelson
is there a way to have a default option defined?
Joe Pea
@trusktr
@yakuzadave I just looked at the require-all package, and as I suspected, it requires all things at once. This will be bad for performance (more noticeable the bigger the CLI gets).
Ideally, if the CLI has three commands a, b, and c, then running the-cli a only imports and executes code from a.js while never touching files for b and c (or similar).
Now imagine the CLI has hundreds of commands, or commands with many options that import logic from different files.

But I suppose you can mitigate it by doing this (based on your snippet of code)

module.exports = function(vorpal, options){
    const dep = require('dependency-needed-by-your-command')
    dep.foo()
}

instead of

const dep = require('dependency-needed-by-your-command')

module.exports = function(vorpal, options){  
    dep.foo()
}

Each command imports all of its dependencies only when called.

But if you move the require or import statements outside of the command functions, then it means when the index files loads all commands it will import every dependency for every command even if the commands aren't all used.
Ryan Proud
@binarymelon
What would be the correct way to escape a single-quote for a vorpal options?