Files
tools/ts/tools.cli.ts

37 lines
1.6 KiB
TypeScript

import * as plugins from './tools.plugins.js';
import * as modUpdate from './mod_update/index.js';
import * as modInstall from './mod_install/index.js';
import { commitinfo } from './00_commitinfo_data.js';
export const run = async () => {
const toolsCli = new plugins.smartcli.Smartcli();
toolsCli.standardCommand().subscribe(async (argvArg) => {
console.log('@git.zone/tools - CLI utility for managing @git.zone packages\n');
console.log('Commands:');
console.log(' update Check and update globally installed @git.zone packages');
console.log(' update -y Update without confirmation prompt');
console.log(' update --verbose Show detection diagnostics');
console.log(' install Interactively install missing @git.zone packages');
console.log(' install -y Install all missing packages without prompts');
console.log(' install --verbose Show detection diagnostics');
console.log('');
console.log('Use "gtools <command> --help" for more information about a command.');
});
toolsCli.addCommand('update').subscribe(async (argvArg) => {
const yesFlag = argvArg.y === true || argvArg.yes === true;
const verboseFlag = argvArg.v === true || argvArg.verbose === true;
await modUpdate.run({ yes: yesFlag, verbose: verboseFlag });
});
toolsCli.addCommand('install').subscribe(async (argvArg) => {
const yesFlag = argvArg.y === true || argvArg.yes === true;
const verboseFlag = argvArg.v === true || argvArg.verbose === true;
await modInstall.run({ yes: yesFlag, verbose: verboseFlag });
});
toolsCli.addVersion(commitinfo.version);
toolsCli.startParse();
};