Comments (8)
If someone ends up here like I did, this fixes the issue:
sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells'
chsh -s /usr/local/bin/bash
As mentioned here: mathiasbynens/dotfiles#544 (comment)
from argcomplete.
The version of bash that you're using as the login shell is not the version that is available on your command line. You can find out the version of the running copy of bash with echo $BASH_VERSION
, and the available copy using type bash
.
To use the newer copy of bash, add it as an available shell into /etc/shells and use chsh
, or customize your Terminal/iTerm2 settings.
from argcomplete.
@peterbe did this resolve your issue?
from argcomplete.
Sorry. Haven't had time to process your response. Vacation coming up meaning rushing to finish things.
from argcomplete.
Actually I have the same problem. I am on OSX Mavericks 10.9.3 which is quite current and after installing argcomplete into the directory I use for completions I am now getting the error
Last login: Sat Jun 28 11:27:17 on ttys005
-bash: complete: -D: invalid option
complete: usage: complete [-abcdefgjksuv] [-pr] [-o option] [-A action]
[-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function]
[-C command] [name ...]
My version of bash is as follows:
[bolt:~] ⌘ bash --version
GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)
Copyright (C) 2007 Free Software Foundation, Inc.
[bolt:~] ⌘ echo $BASH_VERSION
3.2.51(1)-release
[bolt:~] ⌘ type bash
bash is hashed (/bin/bash)
[bolt:~] ⌘ which bash
/bin/bash
I have XCode 5.1.1 and its developer tools installed. (This is the latest public version at the time of this reporting). Is there anything else I should check?
As it currently stands this doesn't appear to work on OSX unless I am doing something wrong... Thanks!
from argcomplete.
Hi @jasonfharris. As the documentation states, you will need to use bash 4.2+ in order to use the global completion feature. As your printout indicates (and I can confirm on Mavericks), you have version 3.2.51.
You can install a newer bash using homebrew or similar, and either run it manually or select it as your shell (via chsh) or as your terminal's startup shell.
Without bash 4.2, the package still works when registering individual files, it's only global completion that doesn't work.
from argcomplete.
Thanks for getting back to me. Can I make a plea for some documentation to cover this being front and centre in the install section? It is kind of not so nice that OSX users on an up to date system can't basically have an off the shelf working version... Ie for myself, I thought I had obviously done something wrong in my configuration or there was something peculiar with my install. It was only towards the end that I realised that maybe things just generally don't work for off the shelf Mavericks without futzing around with it, actually having to read the documentation etc.
Of course like most people my steps were I just skimmed forward, found the install step and ran those two steps. Found that there was an error with putting the script into the completions directory (Maybe a problem only for me or maybe a problem on all OSX systems?), sighed... then went and fixed that problem by specifying a dest directory, then had the -D problem, then started googling around for that quickly and then looking in the issues. Regrettably I didn't find this a smooth process...
In the end I had to find this out via looking into the github issues. MacOSX is likely not an insignificant chunk of the platforms python developers... So a plea for others that come after me to document this a bit more...
But in any case thank you for putting the effort into what otherwise looks like a very useful tools!
Thanks!
from argcomplete.
This seems to still be the top result for the error -bash: complete: -D: invalid option
in 2023, so adding a slight adaptation of @lrepolho solution that works with latest Homebrew installed Bash:
sudo bash -c 'echo /opt/homebrew/bin/bash >> /etc/shells'
chsh -s /opt/homebrew/bin/bash
from argcomplete.
Related Issues (20)
- How do I exclude files in the users directory from the tab completion? HOT 2
- Unable to get completion to work for NetExec HOT 2
- zsh: completion fails with script path starting with '~/' HOT 1
- 3.2.2: pytest is failing HOT 1
- Output of `argcomplete.warn` does not show HOT 4
- Generating lazy completion scripts for Bash/Zsh HOT 1
- Problem with os.get_terminal_size() and argcomplete HOT 2
- completion with a leading dash HOT 2
- Problems with trust path when packaging HOT 6
- No automatic testing on windows? HOT 2
- Python 3.13: Some tests fail when run with latest Python pre-release HOT 5
- Check recent argparse API changes for compatibility HOT 2
- completer falls back to Bash filename completion
- Python 3.12.3: Test suite fails HOT 1
- autocompletion is slow and stuck HOT 2
- Issue with File Path Autocompletion in Argparse Outside Virtual Environment HOT 6
- Inconsistent completion when using a custom validator between `fish` and `bash` HOT 1
- Consider using completer declaration other than "-default-" for zsh global completion HOT 7
- Filesystem style double tab output HOT 1
- Tab Completion does not work, if we register locally using register-python-argcomplete for a particular file only HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from argcomplete.