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
|
||||
.command('add-tag')
|
||||
.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(
|
||||
'-f, --file <file>',
|
||||
'Path to the tasks file',
|
||||
@@ -3743,6 +3746,19 @@ Examples:
|
||||
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 = {
|
||||
projectRoot,
|
||||
commandName: 'add-tag',
|
||||
|
||||
Reference in New Issue
Block a user