
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.
##Well oiled terminal apps
Termoil is built on the simple concept of recursive references to the Termoil object. You create your main instance and then include sub instances (SubRoutines).
npm install --save termoil
var Termoil = require('termoil');
var myapp = new Termoil;
myapp.name('Termoil App');
Usage info is shown when no options are passed or when passing -h, -H and --help
myapp.instructions('myapp [options]');
Termoil allows you to associate multiple versions with your app and define the current active version. Right now the software only makes use of the active version info
myapp.addVersion(new Termoil.Version('1.0', true)) //add active version 1.0
Version is shown by calling -v, -V and --version
myapp.addOption(new Termoil.Option(['-n', '-N', '--name'], 'userName', new Termoil.Option.Type('value', true), 'User name field', 'John Smith', function(val){ return val.toLowerCase(); }));
The Option Object:
The option object is the most complex, customizable and useful class in the Termoil library. It extends the Argument class, which handles processing any arguments passed through process.argv
Check out the Argument api for details on options: https://doclets.io/the-letter-e-production/termoil/master#dl-Argument
Option Args: new Termoil.Option(keys, name, type, description, default, filter);
var keys = ['-n', '-N', '--name'];var name = 'name';var type = 'required';var description = 'My description';var default = 'Default Value';var filter = function(val){ return parseInt(val); };The Option Type Object:
The option type object allows you to determine the behavior of each option.
Option Type Args: new Termoil.Option.Type(key, required, repeating);
repeating values will be stored in an array
There is no limit to how deep you can nest sub routines (inception style)
var mysubapp = new Termoil;
//define all app options here
myapp.addSubRoutine(new Termoil.SubRoutine(['sub'], 'sub', mysubapp));
Usage info will show for subroutines with no options passed as well
myapp sub; #this will show usage info for mysubapp
myapp.parse(Termoil.Skip(process.argv, 2));
You only need to call
.parseon your main app. Parsing of options for SubRoutines will be handled automatically
Options will cascade through SubRoutines. However, they will not be available upstream.
mysubappgets a copy of options frommyapp, butmyappdoesn't see options passed tomysubapp
There are two main ways to make use of options
.parse, since it's a synchronous method. This method can be annoying as you will have to write your own conditionals to handle whether or not options were in fact parsed or SubRoutines got called..on('parsed') event - This is recommended as it will only run the callback if your app actually had options passed to it.//after parse example
myapp.parse(Termoil.Skip(process.argv, 2));
console.log(myapp.get());
//on event example
myapp.on('parsed', function(){
console.log(this.get());
}).parse(Termoil.Skip(process.argv, 2));
Using the
.on('parsed')callback will allow you to access the instance of your Termoil Object usingthis
There are 3 main helper methods you should use to make scripting with termoil easier
myapp.on('parsed', function(){
//get example
var myopt = this.get('myopt'); //return option if exists, else returns false
var opts = this.get(); //return json object of all options
//has example
var boolean = this.has('myopt'); //returns true if option exists, else returns false
var boolean = this.has('myopt', function(myopt){ //returns callback if myopt exists
console.log(myopt); //value of myopt
}); //still returns same boolean
//has all example
var boolean = this.has_all(['myopt', 'youropt']); //return true if both opts exist, else return false
var boolean = this.has_all(['myopt', 'youropt'], function(myopt, youropt){ //returns callback if both opts exist
console.log(myopt, youropt); //values of myopt and youropt
}); //still returns same boolean
}).parse(Termoil.Skip(process.argv, 2));
You can find a list of enhancements that are on the roadmap by clicking here
We hope this documentation is sufficient to get you started with Termoil. However, if you have any questions or require help please open a ticket on GitHub
Built under the ISC License
FAQs
TermOil =================== ##Well oiled terminal apps
The npm package termoil receives a total of 4 weekly downloads. As such, termoil popularity was classified as not popular.
We found that termoil 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.