66
77 "github.com/spf13/cobra"
88
9+ "github.com/oasisprotocol/cli/cmd/common"
910 "github.com/oasisprotocol/cli/config"
1011 "github.com/oasisprotocol/cli/table"
1112)
7071 }
7172
7273 abShowCmd = & cobra.Command {
73- Use : "show <name>" ,
74- Short : "Show address information" ,
75- Args : cobra .ExactArgs (1 ),
74+ Use : "show <name>" ,
75+ Short : "Show address information" ,
76+ Args : cobra .ExactArgs (1 ),
77+ ValidArgsFunction : common .CompleteAddressBookNames ,
7678 Run : func (_ * cobra.Command , args []string ) {
7779 name := args [0 ]
7880 abEntry , ok := config .Global ().AddressBook .All [name ]
@@ -89,10 +91,11 @@ var (
8991 }
9092
9193 abRmCmd = & cobra.Command {
92- Use : "remove <name>" ,
93- Aliases : []string {"rm" },
94- Short : "Remove an address from address book" ,
95- Args : cobra .ExactArgs (1 ),
94+ Use : "remove <name>" ,
95+ Aliases : []string {"rm" },
96+ Short : "Remove an address from address book" ,
97+ Args : cobra .ExactArgs (1 ),
98+ ValidArgsFunction : common .CompleteAddressBookNames ,
9699 Run : func (_ * cobra.Command , args []string ) {
97100 cfg := config .Global ()
98101 name := args [0 ]
@@ -106,10 +109,11 @@ var (
106109 }
107110
108111 abRenameCmd = & cobra.Command {
109- Use : "rename <old> <new>" ,
110- Aliases : []string {"mv" },
111- Short : "Rename address" ,
112- Args : cobra .ExactArgs (2 ),
112+ Use : "rename <old> <new>" ,
113+ Aliases : []string {"mv" },
114+ Short : "Rename address" ,
115+ Args : cobra .ExactArgs (2 ),
116+ ValidArgsFunction : common .CompleteAddressBookNames ,
113117 Run : func (_ * cobra.Command , args []string ) {
114118 cfg := config .Global ()
115119 oldName , newName := args [0 ], args [1 ]
0 commit comments