mite-cli
Version:
command line tool for time tracking service mite.de
36 lines (30 loc) • 1.04 kB
JavaScript
;
const {
getProjectOptions,
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);
// return a list of service ids and default options
const projectOptions = await getProjectOptions();
return [].concat([], options, projectOptions);
};