JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 27
  • Score
    100M100P100Q56978F
  • License MIT

Helper plugin for Gluegun CLI Projects

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 commands
  • getConfig: Extends the handling of the configuration, also for ~/.
  • getDir: Extension of path.join that can handle homedir (~) and automatic OS-specific separator conversion
  • getInput: Checks inputs (e.g. from parameters) and asks if they are not set
  • msToMinutesAndSeconds: Converts milliseconds to minutes:seconds string
  • readFile: Read a file and get the (JSON) data
  • trim: Extension of the string.trim that also replaces line breaks
  • updateCli: 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