Skip to content

Commit d5bc750

Browse files
committed
fix: Error handling for parameters
1 parent 8083385 commit d5bc750

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

cmd/uniget/registry.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ var regRefCmd = &cobra.Command{
7373
Aliases: []string{"ref", "r"},
7474
Short: "Display image reference",
7575
Long: header + "\nDisplay image reference",
76+
Args: cobra.ExactArgs(1),
77+
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
78+
return tools.GetNames(), cobra.ShellCompDirectiveNoFileComp
79+
},
7680
RunE: func(cmd *cobra.Command, args []string) error {
7781
fmt.Println(buildReference(args[0]))
7882

@@ -85,6 +89,10 @@ var regIndexCmd = &cobra.Command{
8589
Aliases: []string{"i"},
8690
Short: "Display image index",
8791
Long: header + "\nDisplay image index",
92+
Args: cobra.ExactArgs(1),
93+
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
94+
return tools.GetNames(), cobra.ShellCompDirectiveNoFileComp
95+
},
8896
RunE: func(cmd *cobra.Command, args []string) error {
8997
format := getFormatString()
9098

0 commit comments

Comments
 (0)