Closed OR13 closed 6 years ago
Never heard of vorpal, but it looks pretty nice. The two biggest features would be support for options and dealing with async/await calls in a sane way. If you think vorpal can handle that, then I'd be very interested to see what you come up with.
I had used commander before but felt it was a bit overkill at the time. Admittedly, the current interface is a bit hacky.
You are right, this could balloon into a lot more features over time. The community extensions parts seem pretty cool.
A couple of notes. If the commands to the CLI don't really interact with each other then they can all be added as command line options. We wouldn't really need a CLI. That being said if we are thinking about future expansions, a CLI makes sense. Vorpal or similar frameworks will let us add commands to a CLI but the CLI won't have a scripting language which means every time a power user decides to use the CLI in a way we never thought of, we will have to make modifications or simply say that use-case is not supported. We could, though, either embed a scripting language into the CLI or make a DSL. Making a DSL doesn't make much sense for our use-case. That would also add an unnecessary learning curve for our users and making a DSL is one extra thing to maintain and worry about. Maybe we should think about embedding a scripting language in the CLI from the get-go.
I mean I know it's sounds like overkill but better to think about it now rather than later.
@bloodstalker good point. Having the command line options seems best. That way users can simply use truebit-os in bash scripts.
The current shell is more of a REPL. If we could find a way to have both that would be ideal. Still I think vorpal can work for both use cases.
We could do both. Not a big deal(famous last words..). For commandline options, we can pick any library that abstracts us away from having to read and parse argv. For the scripting language part, could just use Lua for that. It's small, was written to be embedded. Active community, good libraries. We could use a Lua implementation written in JS or we can just build Lua with Emscripten into WASM and then call from JS(If we want the CLI to be in JS, otherwise we can talk about which language to use to implement as well).
I'm not sure the scripting language is really necessary. I think it will overcomplicate things. The repl can simply use the same commands as the commandline would, like how it is currently implemented.
I guess then vorpal sounds like a good solution. 👍
Sorry for taking so long to read this.
Some very good points.
There is https://github.com/dthree/vorpal/wiki/Docs-%7C-Autocomplete
If you want to allow bash and js side by side, I have used https://github.com/shelljs/shelljs with vorpal before. You can even use this to wrap truffle, which can be very handy.
Here is a simple PR showings how vorpal could work:
Switched to Vorpal. Shout out to @OR13!
I've had a lot of success with https://github.com/dthree/vorpal
You might consider it dev sugar, but it could also be a more extensible foundation to build on, and given how small the current shell is, i thought it would be wise to point it out before this repo blows up because of how awesome TrueBit is :)
If it seems valuable, I'd be happy to provide an implementation of the shell in vorpal.