Live data from Hacker News

Vorpal, a framework for building CLIs

vorpal.js.org

41–43 of 43 posts

Re: Vorpal, a framework for building CLIs

#41
post #8

Author of Vorpal here. You can ask me Qs if you'd like.

Coming from other languages it's very confusing what this library does exactly. The screenshots make it look like a full shell, but looking closer it seems to be more of a high-level API that combines readline and optparse functionality. It might be helpful to split up these parts and explain how they improve on using the builtin NodeJS readline module and something like optparse-js.

Also, a question about piping: in your example the "say" command is hard-coded to use the argument called "words", and the "reverse" command is hard-coded to read from standard input. This seems very limited compared to piping in a real shell, shouldn't each command receive a string/array of input and return output so they can be piped to each other without having to know about it?

Re: Vorpal, a framework for building CLIs

#42
post #8

Author of Vorpal here. You can ask me Qs if you'd like.

Coming from other languages it's very confusing what this library does exactly. The screenshots make it look like a full shell, but looking closer it seems to be more of a high-level API that combines readline and optparse functionality. It might be helpful to split up these parts and explain how they improve on using the builtin NodeJS readline module and something like optparse-js. Also, a question about piping: in…

I get you. Yes, it does combined readline and optparse-type functionality. It's similar to Commander.js, with the exception that you have the option of staying in the "shell" after the first command executes, and then it is its own environment with its own commands.

On piping, I hard coded those to keep it short. Every single command can receive "args.stdin", which is a stdin stream from previous commands. To pipe out, the "this.log" command does all of the heavy lifting.

So all you would need to do is expect both "args.stdin" and "args.words" - that would cover input both from a directly executed command as well as stdin. This works very well in practice.

Re: Vorpal, a framework for building CLIs

#43
post #35
post #16

Earlier quoted context omitted.

I can understand that. Fortunately, Node is becoming huge in terms of CLI - there's a ton of really useful CLI apps for all kinds of things. To the point where it becomes advantageous to have NPM installed, Node developer or not. At that point, installation of a CLI app is easier and more uniform than many other methods. My 0.02. My purpose in writing Vorpal is to make building CLIs accessible to a wider audience. Wh…

> [...] there's a ton of really useful CLI apps for all kinds of things. I'm yet to encounter those.

people use npm cli as a poor excuse for not learning make in most cases.
Post reply on HN