@@ -17,7 +17,8 @@ private struct Show: ParsableCommand {
1717 abstract: " Print the items on the given list " )
1818
1919 @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) )
2122 var listName : String
2223
2324 @Flag ( help: " Show completed items only " )
@@ -56,7 +57,8 @@ private struct Add: ParsableCommand {
5657 abstract: " Add a reminder to a list " )
5758
5859 @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) )
6062 var listName : String
6163
6264 @Argument (
@@ -88,7 +90,8 @@ private struct Complete: ParsableCommand {
8890 abstract: " Complete a reminder " )
8991
9092 @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) )
9295 var listName : String
9396
9497 @Argument (
@@ -105,7 +108,8 @@ private struct Delete: ParsableCommand {
105108 abstract: " Delete a reminder " )
106109
107110 @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) )
109113 var listName : String
110114
111115 @Argument (
@@ -117,12 +121,19 @@ private struct Delete: ParsableCommand {
117121 }
118122}
119123
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+
120130private struct Edit : ParsableCommand {
121131 static let configuration = CommandConfiguration (
122132 abstract: " Edit the text of a reminder " )
123133
124134 @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) )
126137 var listName : String
127138
128139 @Argument (
0 commit comments