yax-cli
v0.5.1
Published
Yet another command line tool helper, multi-level, and generator using Javascript/Typescript. (By the way my last name is Yax)
Maintainers
Readme
yax-cli
Yet another command line tool helper, multi-level, and generator using Javascript/Typescript. (By the way my last name is Yax)
Install
npm install yax-cliDocumentation
Getting started
Main structure
As a example, It uses src as source path.
repository
├── src
│ ├── phone ## relative path
│ │ ├──on
│ │ │ └── index.ts ## implements CommandInterface
│ ├── index.ts ## Command line Register filefiles
Command line register definition file
#!/usr/bin/env node
import { Register } from 'yax-cli'
new Register({
description: 'Phone demo cli',
commandsPath: `${__dirname}/phone`, // Add here your full path to the directory
process, // Procees runtime variable
});phone on command definition
import { CommandInterface } from "yax-cli";
export default class Cmd implements CommandInterface {
description = 'Phone turn on';
examples = [];
validations = [];
handler() {
console.log('Hello moto!');
console.log('Phone turned on :D');
}
};Executing
phone onOutput
Hello moto!
Phone turned on :DShow help
phone --helpoutput
USAGE: phone <COMMAND> [OPTIONS]
DESCRIPTION: Phone demo cli
COMMANDS:
* on
OPTIONS:
--help, -h (optional) Display help