Package Exports
- @lenne.tech/cli-plugin-helper
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@lenne.tech/cli-plugin-helper) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
CLI Plugin: Helper
The CLI-Plugin: Helper integrates the helper extension for Gluegun CLIs.
It contains
commandSelector
: A menu maker for your commandsgetConfig
: Extends the handling of the configuration, also for ~/.getDir
: Extension of path.join that can handle homedir (~) and automatic OS-specific separator conversiongetInput
: Checks inputs (e.g. from parameters) and asks if they are not setmsToMinutesAndSeconds
: Converts milliseconds to minutes:seconds stringreadFile
: Read a file and get the (JSON) datatrim
: Extension of the string.trim that also replaces line breaksupdateCli
: Helps you to keep your CLI up to date- ...
Integration
It can be easily integrated into your CLI:
$ npm install @lenne.tech/cli-plugin-helper
src/cli.ts
:
// ...
const cli = build()
// ...
.plugin('./node_modules/@lenne.tech/cli-plugin-helper/dist', {
commandFilePattern: '*.js',
extensionFilePattern: '*.js'
})
// ...
.create();
// ...
src/interfaces/extended-gluegun-toolbox.ts
:
import { Helper } from '@lenne.tech/cli-plugin-helper';
// ...
/**
* Extended GluegunToolbox
*/
export interface ExtendedGluegunToolbox extends GluegunToolbox {
helper: Helper;
// ...
}
src/commands/git/git.ts
:
import { ExtendedGluegunToolbox } from '../../interfaces/extended-gluegun-toolbox';
/**
* Git commands
*/
module.exports = {
name: 'git',
alias: ['g'],
description: 'Git commands',
hidden: true,
run: async (toolbox: ExtendedGluegunToolbox) => {
const {
helper: { commandSelector }
} = toolbox;
await commandSelector(toolbox, { parentCommand: 'git' });
return 'git';
}
};
Thanks
Many thanks to the developers of Glugun and all the developers whose packages are used here.
License
MIT - see LICENSE