question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

~/.bash_completion.d/python-argcomplete.sh prevents other completions

See original GitHub issue

I noticed a while ago that when I source the script python-argcomplete.sh I cannot tab to complete environment variables. If I comment the last line in the script:

#complete -o default -D -F _python_argcomplete_global

Then I can do:

macbook-pro:~ jmlopez$ echo $PA<TAB>
macbook-pro:~ jmlopez$ echo $PATH

As soon as I activate the global completer then it doesn’t do the environment variable completion anymore. This behavior does not happen when registering an awesome script, i.e.

eval "$(register-python-argcomplete my-awesome-script.py)"

Not sure if this is happening with others, can someone check if this is bug on argparse? I’m using bash 4.2:

macbook-pro:~ jmlopez$ echo $BASH_VERSION
4.2.45(2)-release

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jmlopez-rodcommented, Dec 27, 2013

I found some bash reference on complete and the -o option got my attention:

-o comp-option

The comp-option controls several aspects of the compspec’s behavior beyond the simple generation of completions. comp-option may be one of:

bashdefault Perform the rest of the default Bash completions if the compspec generates no matches. default Use Readline’s default filename completion if the compspec generates no matches.

It seems that adding the bashdefault option fixes the problem:

complete -o default -o bashdefault -D -F _python_argcomplete_global

Now it completes the environment variables as well.

0reactions
jiaslicommented, Jan 10, 2020

Sure. With pleasure!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bash completion from another completion - Stack Overflow
I have a script that requires as an argument the name of command and arguments of that command. So I want to write...
Read more >
scop/bash-completion - GitHub
Programmable completion functions for bash. Contribute to scop/bash-completion development by creating an account on GitHub.
Read more >
Bash completion appends a space after a word - how can I ...
This is the default behaviour for complete when a full match is found, to append a space and allow further typing into the...
Read more >
Creating a bash completion script - iridakos
A tutorial for adding tab completion to your scripts using the Bash Programmable Completion functionality.
Read more >
How to create a Bash completion script - Opensource.com
helping them know the available continuations to their commands; preventing errors and improving their experience by hiding or showing options ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found