UNPKG

mite-cli

Version:

command line tool for time tracking service mite.de

33 lines (27 loc) 1.02 kB
#!/usr/bin/env node 'use strict'; const { getCustomerOptions, removeAlreadyUsedOptions } = require('../helpers'); const defaults = [ { name: '--help', description: 'show help message' } ]; /** * https://www.npmjs.com/package/tabtab#3-parsing-env * * @param {string} env.lastPartial - the characters entered in the current * argument before hitting tabtab * @param {string} env.prev - last given argument value, or previously * completed value * @param {string} env.words - the number of argument currently active * @param {string} env.line - the current complete input line in the cli * @returns {Promise<Array<string>>} */ module.exports = async ({ line }) => { // return default options without the ones which where already entered const options = removeAlreadyUsedOptions(defaults, line); // provide a list of customers const customerOptions = await getCustomerOptions(); return [].concat(options, customerOptions); };