Live data from Hacker News

Vorpal, a framework for building CLIs

vorpal.js.org

31–40 of 43 posts

Re: Vorpal, a framework for building CLIs

#31

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/…

Pretty neat. Just need to remember to restore the environment variables afterwards, especially $PATH.

They're only exported to the sub shell (bash on last line of cli script). Quitting the sub shell would restore them. Perhaps you were confused by the absence of `service:$` in the prompt for the upload command, which I believe was an oversight.

Re: Vorpal, a framework for building CLIs

#32
post #24
post #21

Earlier quoted context omitted.

But a benefit might be cross-platform compatibility seeing as some OSes don't come with, say, grep out of the box. While you could use the native tools, there could be some benefit to writing your own to do exactly what you want consistently. I don't really disagree with you, but just pointing out there is some benefit to writing one's own CLI.

I think its easier to install cygwin than replace all the command line tools I am used to with Javascript equivalents.

Or install ports of enough to get work done. Ag works very well on Windows.

Re: Vorpal, a framework for building CLIs

#33

Earlier quoted context omitted.

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.

* I accidentally downvoted you while trying to upvote.

Re: Vorpal, a framework for building CLIs

#34
post #11

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/…

True. Though in Node, you can make calls to standard programs, so it can act pretty seamlessly. And there's already a lot of direction towards supporting a lot of familiar methods and more. Like this: https://www.npmjs.com/package/cash

cash looks great, but how does chmod work on Windows?

Re: Vorpal, a framework for building CLIs

#35
post #16
post #14

Earlier quoted context omitted.

My problem is with npm and nodejs dependency, for writing CLI, which essentially means you have to install nodejs and is probably only really useful for nodejs developers.

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.

Re: Vorpal, a framework for building CLIs

#36
post #24
post #21

Earlier quoted context omitted.

But a benefit might be cross-platform compatibility seeing as some OSes don't come with, say, grep out of the box. While you could use the native tools, there could be some benefit to writing your own to do exactly what you want consistently. I don't really disagree with you, but just pointing out there is some benefit to writing one's own CLI.

I think its easier to install cygwin than replace all the command line tools I am used to with Javascript equivalents.

I think GOW (GNU on Windows) is a better alternative to cygwin.

Re: Vorpal, a framework for building CLIs

#38
post #24
post #21

Earlier quoted context omitted.

But a benefit might be cross-platform compatibility seeing as some OSes don't come with, say, grep out of the box. While you could use the native tools, there could be some benefit to writing your own to do exactly what you want consistently. I don't really disagree with you, but just pointing out there is some benefit to writing one's own CLI.

I think its easier to install cygwin than replace all the command line tools I am used to with Javascript equivalents.

I am still holding my breath for Windows 10 to start including more and more Unix tools. We finally have ssh to be included with Windows 10 and having tools awk, sed, grep on Windows seems like a logical move for Microsoft EVENTUALLY.

For now I use vagrant all the time when I am on Windows.

Re: Vorpal, a framework for building CLIs

#39
post #33

Earlier quoted context omitted.

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.

* I accidentally downvoted you while trying to upvote.

It's the thought that matters ;)

Re: Vorpal, a framework for building CLIs

#40
post #21
post #12

ah, the javascript developer mindset applied to CLI development. Start from scratch just because you don't want to read the manual of the right technology, convince lots of people to adopt with a cool site, spend the next 5 years updating your project to get to 10% of the 20yr old projects you ignored. disclaimer: mostly javascript developer nowadays. but salty.

But a benefit might be cross-platform compatibility seeing as some OSes don't come with, say, grep out of the box. While you could use the native tools, there could be some benefit to writing your own to do exactly what you want consistently. I don't really disagree with you, but just pointing out there is some benefit to writing one's own CLI.

> But a benefit might be cross-platform compatibility seeing as some OSes don't come with, say, grep out of the box

If you have git installed on your machine you have grep ( windows users) and most of linux command tools.

Post reply on HN