
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
⚠️ NOTICE ⚠️
This library is not maintained anymore.
Kindly checkout its spiritual successor: viteshell
A minimal shell implementation for xterminal
vitesh?vitesh comes from vite, a French word for "quick" and sh, (or shell) a program that executes other programs in response to text commands.
vitesh is lightweight shell implementation written in TypeScript that tends to work just a like bash. It is intended for use with xterminal but can as well be used elsewhere.
Note: Currently,
viteshonly provides a platform for adding and executing commands. Support for functionalities like input/output redirection, shell scripts, shell expansion and job control is not provided.
viteshprovides a shell interface that allows you to add custom commands and also execute them programmatically.
Install the module via npm. Run the following command to add as a dependency.
npm install vitesh
Then import the package:
import Shell from 'vitesh'
You can install vitesh using any CDN that delivers packages from npm registry, for example: unpkg, jsdelivr
Using unpkg:
<script type="text/javascript" src="https://unpkg.com/vitesh/dist/vitesh.js"></script>
Using jsDelivr:
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vitesh/dist/vitesh.js"></script>
The full public API for vitesh is contained within the TypeScript declaration file. It helps you understand the different interfaces required to setup your shell.
To use vitesh, you need a terminal interface for inputting and outputting text.
XTerminal provides that interface, learn how to install xterminal here.
<div id="app"></div>
const term = new XTerminal();
term.mount('#app');
const shell = new Shell(term, {
username: 'root',
hostname: 'web',
ps1: '$ '
});
You can add custom commands like hello:
...
shell.addCommand('hello', {
desc: 'A command that greets the user',
usage: 'hello [...name]',
action(process) {
const { argv, stdout } = process;
if (argv.length) {
stdout.write(`Hello ${argv.join(' ')}.\nIt is your time to shine.\n`);
} else {
stdout.write(`Opps!! I forgot your name.`);
}
}
});
You can also programmatically execute the commands;
...
(async () => {
await shell.execute('help');
});
Sometimes we need to run commands basing on the success or failure of the previously executed command or just normally. For example;
echo "1" && echo "2" : If the first command (echo 1) is succesfully, then echo 2 will be executed.echo "1" || echo "2" : The second command (echo 2) will not be executed if the first was succesfull.echo "1" ; echo "2" : Both commands are executed irrespective of the success of the previously executed command.Generators, Promises, and some other latest ECMAScript features are used in the source code. Supporting a wide range of browsers is the goal. Modern browsers, most specifically the latest versions of Chrome, Firefox, Safari, and Edge (for desktop and mobile devices) are supported.
Copyright (c) 2023 Henry Hale.
Released under the MIT License.
FAQs
A minimal shell implementation for xterminal
We found that vitesh demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.