Initial commit

This commit is contained in:
Marcelo
2025-11-20 15:27:34 -06:00
commit cc72c9fc5d
3221 changed files with 737477 additions and 0 deletions

56
node_modules/cliss/test/specs/complex-cases/index.js generated vendored Normal file
View File

@@ -0,0 +1,56 @@
'use strict';
const cliss = require('../../../');
const cliSpec = {
name: 'main-command',
description: 'Main command description',
version: '1.0.0',
commands: [{
name: 'nested-command-1',
description: 'nested-command-1 description',
version: '2.1.0',
options: [{
name: 'p1',
required: true
}, {
name: 'p2',
required: true,
description: 'p2 description'
}],
action: (p1 = 'p1Default', p2) => {
return `${p1}-${p2}`;
}
}, {
name: 'nested-command-promise',
action: (...args) => {
return new Promise((resolve, reject) => {
setTimeout(() => resolve('promise resolved'), 1500);
});
}
}, {
name: 'nested-command-variadic',
action: (...args) => {
return args.reduce((result, v) => result += v);
}
}, {
name: 'nested-command-set-with-no-action',
commands: [{
name: 'inner-nested-command-set',
action: (param1, param2) => param2 + param1
}]
}, {
name: 'nested-command-set-with-action',
action: (param1, param2) => param1 + param2,
commands: [{
name: 'inner-nested-command-set',
action: (param1, param2) => param2 + param2 + param1
}]
}]
};
cliss(cliSpec, {
help: {
stripAnsi: true
}
});

144
node_modules/cliss/test/specs/complex-cases/specs.js generated vendored Normal file
View File

@@ -0,0 +1,144 @@
'use strict';
const helpOutput = `
Description:
Main command description
Usage:
$ main-command <command>
Commands:
nested-command-1 nested-command-1 description
nested-command-promise
nested-command-variadic
nested-command-set-with-no-action
nested-command-set-with-action
`;
const nestedCommand1HelpOutput = `
Description:
nested-command-1 description
Usage:
$ main-command nested-command-1 <options>
Options:
--p1 Required
--p2 Required - p2 description
`;
const nestedCommandPromiseHelpOutput = `
Usage:
$ main-command nested-command-promise [options] [args...]
Options:
--args
`;
const nestedCommandSetWithNoActionHelpOutput= `
Usage:
$ main-command nested-command-set-with-no-action <command>
Commands:
inner-nested-command-set
`;
const nestedCommandSetWithActionHelpOutput= `
Usage:
$ main-command nested-command-set-with-action [options]
$ main-command nested-command-set-with-action [command]
Options:
--param1
--param2
Commands:
inner-nested-command-set
`;
const tests = [{
description: 'Main command version',
input: '--version',
output: `1.0.0`
}, {
description: 'Main command help (when there is no args for a command without an action)',
input: '',
output: helpOutput
}, {
description: 'Main command help',
input: '--help',
output: helpOutput
}, {
description: 'Nested command help',
input: 'nested-command-1 --help',
output: nestedCommand1HelpOutput
}, {
description: 'Nested command specific version',
input: 'nested-command-1 --version',
output: `2.1.0`
}, {
description: 'Nested command call',
input: 'nested-command-1',
output: `p1Default-undefined`
}, {
description: 'Nested command call passing in options / args',
input: 'nested-command-1 --p2=P2 --p1=P1',
output: `P1-P2`
}, {
description: 'Nested command help showing variading arguments (based on rest parameters definition)',
input: 'nested-command-promise --help',
output: nestedCommandPromiseHelpOutput
}, {
description: 'Nested command version (getting the value from main command)',
input: 'nested-command-promise --version',
output: `1.0.0`
}, {
description: 'Nested command call resolving a Promise',
input: 'nested-command-promise',
output: `promise resolved`
}, {
description: 'Nested command call variadic arguments',
input: 'nested-command-variadic 1 9 8 4',
output: `22`
}, {
description: 'Nested command call variadic arguments (with arbitrary named options)',
input: 'nested-command-variadic --a=1 --b=9 --c=8 --d=4',
output: `22`
}, {
description: 'Nested command with no action plus having more nested commands defined --help',
input: 'nested-command-set-with-no-action --help',
output: nestedCommandSetWithNoActionHelpOutput
}, {
description: 'Nested command, of an already nested command, call (3 level deep)',
input: 'nested-command-set-with-no-action inner-nested-command-set --param1=A --param2=B',
output: `BA`
}, {
description: 'Nested command with action plus having more nested commands defined --help',
input: 'nested-command-set-with-action --help',
output: nestedCommandSetWithActionHelpOutput
}, {
description: 'Nested command with action plus having more nested commands defined call',
input: 'nested-command-set-with-action --param1=A --param2=B',
output: `AB`
}, {
description: 'Nested command, of an already nested command, call (3 level deep, when the parent also contains an action)',
input: 'nested-command-set-with-action inner-nested-command-set --param1=A --param2=B',
output: `BBA`
}];
module.exports = tests;