I was looking into developing a piral-cli extension and had a couple questions about the CliPluginApi
interface:
module.exports = function (cliApi) {
cliApi.withCommand({
name: 'dependencies-pilet',
alias: ['deps-pilet'],
description: 'Lists the dependencies of the current pilet.',
arguments: [],
flags(argv) {
return argv
.boolean('only-shared')
.describe('only-shared', 'Only outputs the declared shared dependencies.')
.default('only-shared', false)
.string('base')
.default('base', process.cwd())
.describe('base', 'Sets the base directory. By default the current directory is used.');
},
run(args) {
// your code here, where args.onlyShared refers to our custom argument
},
});
};
What is the distinction between arguments
and flags
in a ToolCommand
? Are arguments just required positional arguments? Need the positionals be listed again?
Final question on this one - I want to get a list of positionals like an array. Whats the syntax for this? I tried arguments: ['list[]'],
but it did not work.