@lazy-toolbox/lazy-cli

1.0.0 • Public • Published

logo

Lazy-CLI

A full portable CLI that can be fully modded with injected modules.

The source code is available on GitHub. You can find some mods on this link.

You can install the lazy-cli with:

npm install -g @lazy-toolbox/lazy-cli

Or update it ?

npm i -g @lazy-toolbox/lazy-cli@latest

Index

Updates

1.0.0

Remade from the ground and tested in various ways, it's now adapted for full modding injection with a better database handling and a lot of error removal. There shouldn't be any more updates.

0.1.0

Starting from v0.1.0, the lazy-cli will be as simple as possible, containing only required tools for new mods.

Modules

To make a module, create a .js script containing the following structure:

module.exports = (program, config) => {

};

The program parameter is of type Commander from commander package. See it's documentation for more infos. The config parameter is of type Config and is structured as follow:

interface Config {
    // The path from where the command was used
    commandPath: string;
    // The path from where the modules are saved
    rootPath: string;
    // The path from where all files from fdb are saved
    dbPath: string;
    // Get all fdb files and directories list from a fdb path and choose to write them as relative or not.
    getAllDB: (pathSrc: string, relative: boolean) => string[];
    // Get all fdb files list from a fdb path and choose to write them as relative or not.
    getAllDBFiles: (pathSrc: string, relative: boolean) => string[];
    // Get all fdb directories list from a fdb path and choose to write them as relative or not.
    getAllDBDirs: (pathSrc: string, relative: boolean) => string[];
    // Get the content of a fdb file if it exist, undefined otherwise.
    getDBFile: (pathStr: string) => string | undefined;
    // Set a new file in fdb at pathStr, taking a source file and can be overridden.
    setDBFile: (source: string, pathStr: string, override: boolean) => void;
    // Set a new directory in fdb at pathStr, taking a source file and can be overridden.
    setDBDir: (source: string, pathStr: string, override: boolean) => void;
    // Set a new directory or file in fdb at pathStr, taking a source file and can be overridden.
    setDBAny: (source: string, pathStr: string, override: boolean) => void;
    // Remove a file from fdb.
    removeDBFile: (pathStr: string) => void;
    // Remove a directory from fdb.
    removeDBDir: (pathStr: string) => void;
    // Remove a file or a directory from fdb.
    removeDBAny: (pathStr: string) => void;
}

All you have to do after that is add the module:

lazy-cli mod -a myNewMod.js

The module command will be available with:

lazy-cli <YOUR_COMMAND>

Commands

mod

Manage the CLI modules.

mod [-a, --add <modulePath>] [-o, --override] [-r, --remove <modulePath>] [-l, --list] [-s, --show <dataPath>]
  • -a|--add <modulePath>: Add a module into the CLI modules. The module must be a .js file.
  • -o|--override: In case the new module has the same name as another one, override it.
  • -r|--remove <modulePath>: Remove a module from the CLI modules.
  • -s|--show <dataPath>: Show the file content of the specified CLI module.
  • -l|--list: List all installed CLI modules.

Use the @mod to see the saved mod path.

fdb

Manage the CLI file database.

fdb <currentPath> [-a, --add <dbFilePath>] [-o, --override] [-r, --remove] [-s, --show] [-l, --list]
  • <currentPath>
  • -a|--add <filePath>: Insert a <currentPath> into the file database as <dbFilePath>.
  • -o|--override: In case the <dbFilePath> has the same name as an already existing one, override it.
  • -r|--remove: Remove the <currentPath>.
  • -s|--show: Show the content of the <currentPath> as a string on the console if it's a file.
  • -l|--list: Show a list of all directories and files inside the file database.

Use the @fdb to see the saved mod path.

Package Sidebar

Install

npm i @lazy-toolbox/lazy-cli

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

39.3 kB

Total Files

18

Last publish

Collaborators

  • friquet-luca