File tree 3 files changed +65
-0
lines changed
3 files changed +65
-0
lines changed Original file line number Diff line number Diff line change @@ -271,3 +271,61 @@ command line. This is handy for values containing new lines for instance:
271
271
It is obviously the best project around
272
272
EOF
273
273
$ gitlab project create --name SuperProject --description @/tmp/description
274
+
275
+ Enabling shell autocompletion
276
+ ============================
277
+
278
+ To get autocompletion, you'll need to install the package with the extra
279
+ "autocompletion":
280
+
281
+ .. code-block :: console
282
+
283
+ pip install python_gitlab[autocompletion]
284
+
285
+
286
+ Add the appropriate command below to your shell's config file so that it is run on
287
+ startup. You will likely have to restart or re-login for the autocompletion to
288
+ start working.
289
+
290
+ Bash
291
+ ----
292
+
293
+ .. code-block :: console
294
+
295
+ eval "$(register-python-argcomplete gitlab)"
296
+
297
+ tcsh
298
+ ----
299
+
300
+ .. code-block :: console
301
+
302
+ eval `register-python-argcomplete --shell tcsh gitlab`
303
+
304
+ fish
305
+ ----
306
+
307
+ .. code-block :: console
308
+
309
+ register-python-argcomplete --shell fish gitlab | .
310
+
311
+ Zsh
312
+ ---
313
+
314
+ .. warning ::
315
+
316
+ Zsh autocompletion support is broken right now in the argcomplete python
317
+ package. Perhaps it will be fixed in a future release of argcomplete at
318
+ which point the following instructions will enable autocompletion in zsh.
319
+
320
+ To activate completions for zsh you need to have bashcompinit enabled in zsh:
321
+
322
+ .. code-block :: console
323
+
324
+ autoload -U bashcompinit
325
+ bashcompinit
326
+
327
+ Afterwards you can enable completion for gitlab:
328
+
329
+ .. code-block :: console
330
+
331
+ eval "$(register-python-argcomplete gitlab)"
Original file line number Diff line number Diff line change @@ -172,6 +172,12 @@ def main():
172
172
173
173
# Now we build the entire set of subcommands and do the complete parsing
174
174
parser = _get_parser (cli_module )
175
+ try :
176
+ import argcomplete
177
+
178
+ argcomplete .autocomplete (parser )
179
+ except Exception :
180
+ pass
175
181
args = parser .parse_args (sys .argv [1 :])
176
182
177
183
config_files = args .config_file
Original file line number Diff line number Diff line change @@ -45,4 +45,5 @@ def get_version():
45
45
"Programming Language :: Python :: 3.7" ,
46
46
"Programming Language :: Python :: 3.8" ,
47
47
],
48
+ extras_require = {"autocompletion" : ["argcomplete>=1.10.0,<2" ]},
48
49
)
You can’t perform that action at this time.
0 commit comments