deprecate(polecat): add migration warning to gt polecat add
Add deprecation warning pointing users to 'gt polecat identity add': - Cobra Deprecated field emits automatic warning on command use - Custom warning in runPolecatAdd for prominent stderr output - Updated help text with deprecation notice and new command example The command still functions but will be removed in v1.0. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -59,15 +59,19 @@ Examples:
|
|||||||
}
|
}
|
||||||
|
|
||||||
var polecatAddCmd = &cobra.Command{
|
var polecatAddCmd = &cobra.Command{
|
||||||
Use: "add <rig> <name>",
|
Use: "add <rig> <name>",
|
||||||
Short: "Add a new polecat to a rig",
|
Short: "Add a new polecat to a rig (DEPRECATED)",
|
||||||
|
Deprecated: "use 'gt polecat identity add' instead. This command will be removed in v1.0.",
|
||||||
Long: `Add a new polecat to a rig.
|
Long: `Add a new polecat to a rig.
|
||||||
|
|
||||||
|
DEPRECATED: Use 'gt polecat identity add' instead. This command will be removed in v1.0.
|
||||||
|
|
||||||
Creates a polecat directory, clones the rig repo, creates a work branch,
|
Creates a polecat directory, clones the rig repo, creates a work branch,
|
||||||
and initializes state.
|
and initializes state.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
gt polecat add greenplace Toast`,
|
gt polecat identity add greenplace Toast # Preferred
|
||||||
|
gt polecat add greenplace Toast # Deprecated`,
|
||||||
Args: cobra.ExactArgs(2),
|
Args: cobra.ExactArgs(2),
|
||||||
RunE: runPolecatAdd,
|
RunE: runPolecatAdd,
|
||||||
}
|
}
|
||||||
@@ -426,6 +430,11 @@ func runPolecatList(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runPolecatAdd(cmd *cobra.Command, args []string) error {
|
func runPolecatAdd(cmd *cobra.Command, args []string) error {
|
||||||
|
// Emit deprecation warning
|
||||||
|
fmt.Fprintf(os.Stderr, "%s 'gt polecat add' is deprecated. Use 'gt polecat identity add' instead.\n",
|
||||||
|
style.Warning.Render("Warning:"))
|
||||||
|
fmt.Fprintf(os.Stderr, " This command will be removed in v1.0.\n\n")
|
||||||
|
|
||||||
rigName := args[0]
|
rigName := args[0]
|
||||||
polecatName := args[1]
|
polecatName := args[1]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user