The file name to parse.
Object containing the spread operator, parameter name, and file extension, if any.
// A single parameter with no file extension
parseFileName('[foo]');
// => {
// spreadOperator: undefined,
// paramName: 'foo',
// extension: undefined,
// }
// A single parameter
parseFileName('[foo].ts');
// => {
// spreadOperator: undefined,
// paramName: 'foo',
// extension: '.ts',
// }
// A spread operator parameter
parseFileName('[...foo].ts');
// => {
// spreadOperator: '...',
// paramName: 'foo',
// extension: '.ts',
// }
// Not a parameterized command file
parseFileName('foo.ts');
// => {
// spreadOperator: undefined,
// paramName: undefined,
// extension: undefined,
// }
Parses a file name to determine if it's a parameterized command file.
Parameterized command files are named using the following format:
[param]
- A single parameter with no file extension[param].ts
- A single parameter[...param].ts
- A spread operator parameter