fix(commands): Fix add-tag --from-branch requiring tagName argument
- Made tagName optional when using --from-branch - Added validation for either tagName or --from-branch - Fixes 'missing required argument' error with --from-branch option
This commit is contained in:
@@ -3701,7 +3701,10 @@ Examples:
|
|||||||
programInstance
|
programInstance
|
||||||
.command('add-tag')
|
.command('add-tag')
|
||||||
.description('Create a new tag context for organizing tasks')
|
.description('Create a new tag context for organizing tasks')
|
||||||
.argument('<tagName>', 'Name of the new tag to create')
|
.argument(
|
||||||
|
'[tagName]',
|
||||||
|
'Name of the new tag to create (optional when using --from-branch)'
|
||||||
|
)
|
||||||
.option(
|
.option(
|
||||||
'-f, --file <file>',
|
'-f, --file <file>',
|
||||||
'Path to the tasks file',
|
'Path to the tasks file',
|
||||||
@@ -3743,6 +3746,19 @@ Examples:
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate that either tagName is provided or --from-branch is used
|
||||||
|
if (!tagName && !options.fromBranch) {
|
||||||
|
console.error(
|
||||||
|
chalk.red(
|
||||||
|
'Error: Either tagName argument or --from-branch option is required.'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
console.log(chalk.yellow('Usage examples:'));
|
||||||
|
console.log(chalk.cyan(' task-master add-tag my-tag'));
|
||||||
|
console.log(chalk.cyan(' task-master add-tag --from-branch'));
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
const context = {
|
const context = {
|
||||||
projectRoot,
|
projectRoot,
|
||||||
commandName: 'add-tag',
|
commandName: 'add-tag',
|
||||||
|
|||||||
Reference in New Issue
Block a user