0.4.0 • Published 10 months ago
yax-cli v0.4.0
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-cli
Documentation
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 file
files
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 on
Output
Hello moto!
Phone turned on :D
Show help
phone --help
output
USAGE: phone <COMMAND> [OPTIONS]
DESCRIPTION: Phone demo cli
COMMANDS:
* on
OPTIONS:
--help, -h (optional) Display help
That's it, I hope this tool can help you :)
https://github.com/MiguelYax/yax-cli/blob/feature/monorepo/packages/yax-cli/README.md https://github.com/MiguelYax/yax-cli/blob/main/docs/MULTI-LEVEL.md