Vorpal, a framework for building CLIs
vorpal.js.org
Vorpal, a framework for building CLIs
1–10 of 43 posts
Re: Vorpal, a framework for building CLIs
#2Re: Vorpal, a framework for building CLIs
#3This looks more like a complete shell replacement than a general-purpose CLI builder.
Re: Vorpal, a framework for building CLIs
#4Re: Vorpal, a framework for building CLIs
#5Something about imitating the semantics of a UNIX shell in JavaScript doesn't sit well with me.
Re: Vorpal, a framework for building CLIs
#6 #!/usr/bin/env bash
export REMOTE_ADDR="$1"
export PATH="$(dirname $0)/commands:$PATH"
export PS1='service:\$ '
bash
Now you do something like: $ server-cli https://myservice.com
service:$ which upload
/path/to/server-cli/commands/upload
$ upload ./my-file.png
uploading.......
All you are doing here is adding all your custom commands (which are just command line applications), and starting up the CLI by giving it some context of some sort. All I have here is $REMOTE_ADDR (which by convention a command like upload would read), but you could have auth or whatever.Along with this, you get a pretty workable programming language (shell), access to the local environment, access to the "standard library" of commands you know, and so on.
Re: Vorpal, a framework for building CLIs
#7Something about imitating the semantics of a UNIX shell in JavaScript doesn't sit well with me.
I guess if you're building a CLI intensive application in node to begin with then this library seems like a pretty nifty way to do it. I've used plenty of CLI tools that don't offer auto-complete where it really would be handy to see.
It's a personal preference, but I'd much prefer my programs (node or otherwise) treat the shell like the first class citizen it is and use it to its fullest extent.
Re: Vorpal, a framework for building CLIs
#8Re: Vorpal, a framework for building CLIs
#9Re: Vorpal, a framework for building CLIs
#10For those who want to make simpler Node CLIs, check out meow[1]. [1] https://github.com/sindresorhus/meow