
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Termos is a package that lets you easily create CLI tools in Node.js using idiomatic ES6 syntax (Node 4+). It's also simple to create associated manual (help) pages for each command.
To use Termos, first install it in your Node project with npm install termos --save.
Next, modify your project's package.json to include:
"bin": {
"mycli": "./cli.js"
}
Where mycli is the intended name of your command in the CLI.
Now create a file: ./cli.js and folder ./commands:
#!/usr/bin/env node
'use strict';
const CommandLineInterface = require('termos').CommandLineInterface;
const CLI = new CommandLineInterface();
CLI.load(__dirname, './commands');
CLI.run(process.argv.slice(2));
Finally, populate your commands directory with your commands, here's an example
file: ./commands/example.js
module.exports = (() => {
'use strict';
const Command = require('termos').Command;
class ExampleCommand extends Command {
constructor() {
super('example');
}
help() {
return {
description: 'An example command',
args: ['example_arg1', 'example_arg2'],
flags: {flag: 'An example flag'},
vflags: {vflag: 'An example verbose flag'}
};
}
run(args, flags, vflags, callback) {
// Run code here.
// To throw an error, use: callback(new Error(msg))
// To optionally return a result, use: callback(null, result)
callback(null);
}
}
return ExampleCommand;
})();
View all the commands available to your CLI with mycli help where mycli is
the intended name of your command in the CLI. To modify help information,
change the return value of the help() method for each command.
To subclass a command (i.e. mycli command_name:sub_name) simply change the contructor()
method in your command to the following:
constructor() {
super('command_name', 'sub_name');
}
Each command has a run() method which takes three arguments: args, flags,
and vflags.
args is the array of arguments, passed before any flags.
i.e. mycli command alpha beta would populate args with ['alpha', 'beta']
flags is an object containing any flags (prefixed with -), where each entry
is an array of values passed after the flag
i.e. mycli command -f my flag would populate vflags with {f: ['my', 'flag']}
vflags works identically to flags, but with "verbose flags" (prefixed
with --).
All argument arrays passed to args or any flags or vflags options will
be separated by spaces, except in the case of quotation marks. Use
quotation marks to specify an argument with spaces in it.
i.e. mycli command -f "argument one" argument_two
Thanks for checking out the library! Feel free to submit issues or PRs if you'd like to see more features.
Based on cmnd.
FAQs
Terminal framework for js
The npm package termos receives a total of 6 weekly downloads. As such, termos popularity was classified as not popular.
We found that termos 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

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.