Live data from Hacker News

Vorpal, a framework for building CLIs

vorpal.js.org

1–10 of 43 posts

Re: Vorpal, a framework for building CLIs

#5

Something 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.

Re: Vorpal, a framework for building CLIs

#6
If I was making an interactive command line, I think I'd want to do it all in shell. Let's say it's a CLI that interacts with a remote server, then I might have a "script" that "starts" a custom CLI by doing:

    #!/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

#7

Something 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.

I suppose so. My big concern is that this will lead of a lot of faux-shells with relatively few syntactic similarities.

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.

Post reply on HN