Comment

Comment by _carl_jung

Sorry for the late response.

> execute relatively small snippets of shell code/one-liners as part of an asset management pipeline without having to "shell-out" and invoke an external process

This is indeed a small part of the value of my shell, though I wouldn't view it as the primary reason. I'm trying to make a nice experience for an interactive command line shell first, then will think about scripting use cases.

Blurring that line between shell + scripting is my intention, so it would be good to capture your case here at some point.

> Requirements for shell control constructs are modest, but piping and redirection should work, as well as limited shell var/macros expansion, and maybe if/then.

I'm struggling to understand one detail of your use case here. Is this a script (stored as some e.g. .js file), or something you'd be executing interactively? If the former, my shell does have as part of its library a suite of tools for executing shell commands (including piping + redirect) from within the Deno runtime. That would make something like the following possible:

const jsFilesInDirectory = await exec('ls | grep .js');

if (jsFilesInDirectory.includes('index.js') {

  // some logic
}

The above is also strikingly similar to shelljs, but my solution differs in a key way: where shelljs is re-implementing many commands, I've developed logic for parsing and evaluating any shell-like "pipe-separated" commands.

In any case, the primary intention of my project is to create an interactive shell, not a scripting language. That said, it would be possible to tease out and reproduce my logic to parse and execute piped commands in Node.js, to allow for a slightly more capable "shelljs" clone.

Hope that helps.

parent _carl_jung 6 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton