@@ -17,7 +17,8 @@ private struct Show: ParsableCommand {
17
17
abstract: " Print the items on the given list " )
18
18
19
19
@Argument (
20
- help: " The list to print items from, see 'show-lists' for names " )
20
+ help: " The list to print items from, see 'show-lists' for names " ,
21
+ completion: . custom( listNameCompletion) )
21
22
var listName : String
22
23
23
24
@Flag ( help: " Show completed items only " )
@@ -56,7 +57,8 @@ private struct Add: ParsableCommand {
56
57
abstract: " Add a reminder to a list " )
57
58
58
59
@Argument (
59
- help: " The list to add to, see 'show-lists' for names " )
60
+ help: " The list to add to, see 'show-lists' for names " ,
61
+ completion: . custom( listNameCompletion) )
60
62
var listName : String
61
63
62
64
@Argument (
@@ -88,7 +90,8 @@ private struct Complete: ParsableCommand {
88
90
abstract: " Complete a reminder " )
89
91
90
92
@Argument (
91
- help: " The list to complete a reminder on, see 'show-lists' for names " )
93
+ help: " The list to complete a reminder on, see 'show-lists' for names " ,
94
+ completion: . custom( listNameCompletion) )
92
95
var listName : String
93
96
94
97
@Argument (
@@ -105,7 +108,8 @@ private struct Delete: ParsableCommand {
105
108
abstract: " Delete a reminder " )
106
109
107
110
@Argument (
108
- help: " The list to delete a reminder on, see 'show-lists' for names " )
111
+ help: " The list to delete a reminder on, see 'show-lists' for names " ,
112
+ completion: . custom( listNameCompletion) )
109
113
var listName : String
110
114
111
115
@Argument (
@@ -117,12 +121,19 @@ private struct Delete: ParsableCommand {
117
121
}
118
122
}
119
123
124
+ func listNameCompletion( _ arguments: [ String ] ) -> [ String ] {
125
+ // NOTE: A list name with ':' was separated in zsh completion, there might be more of these or
126
+ // this might break other shells
127
+ return reminders. getListNames ( ) . map { $0. replacingOccurrences ( of: " : " , with: " \\ : " ) }
128
+ }
129
+
120
130
private struct Edit : ParsableCommand {
121
131
static let configuration = CommandConfiguration (
122
132
abstract: " Edit the text of a reminder " )
123
133
124
134
@Argument (
125
- help: " The list to edit a reminder on, see 'show-lists' for names " )
135
+ help: " The list to edit a reminder on, see 'show-lists' for names " ,
136
+ completion: . custom( listNameCompletion) )
126
137
var listName : String
127
138
128
139
@Argument (
0 commit comments