Giter Club home page Giter Club logo

bash-completion's People

Contributors

a1346054 avatar aaronkrogers avatar akinomyoga avatar algorythmic avatar cdleonard avatar code5hot avatar dpaleino avatar felixonmars avatar fvue avatar garik avatar github-actions[bot] avatar guillomovitch avatar inconstante avatar inigomartinez avatar jakseb avatar jakuje avatar kevinoid avatar lekensteyn avatar mattulbrich avatar mgorny avatar mlichvar avatar renovate-bot avatar renovate[bot] avatar rogach avatar rrthomas avatar sathieu avatar scop avatar sftp avatar tobiasbrunner avatar yedayak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bash-completion's Issues

Make completion results in sed error

When typing make and pressing <tab> for tab-completion, I get the following error:

sed: 46: /dev/fd/63: extra characters at the end of d command

This occurs for even the simplest Makefiles, e.g.

foo:

I am using bash-completion on OS X through the bash-completion2 Homebrew package, version 2.4.

OS X comes with BSD sed. This may be the cause:

Many of the completion functions assume GNU versions of the various text utilities that they call (e.g. grep, sed and awk). Your mileage may vary.

I also tried this without loading my .bashrc and .inputrc, but still encountered the issue. If no one is able to replicate the error, maybe I am unintentionally loading some other rc file...

For reference, tab-completion on make without bash-completion loaded works, although not as you would hope: it tries to complete with a list of files in the current directory.

ssh not completing from known_hosts

I've installed 2.1 from homebrew on osx, and for some reason the ssh completer for known hosts is not being run (or registered, I think). I was using an older version 1 that correctly completed via known hosts.

To confuse the matter, if I try to complete after sshfs <TAB>, that will successfully load from known_hosts. It seems that once known_hosts has been triggered, then regular ssh <TAB> will correctly list all known hosts.

The same behaviour occurs whether or not a hostname is partially written already, such as ssh dat<TAB> produces no output (unless another known_hosts completer has executed).

Bash version is 4.3.42:

$ bash -version
GNU bash, version 4.3.42(1)-release (x86_64-apple-darwin14.5.0)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

I know this isn't much to go by, so if I can provide anything extra please let me know and I'll do so happily.

Here's an example from a new terminal session:

smeatonj ~/Development
$ complete -p | grep ssh
github.com' ssh
complete -F _known_hosts ssh-installkeys

smeatonj ~/Development
$ ssh <TAB>
private.com.au github.com

smeatonj ~/Development
$ complete -p | grep ssh
github.com' ssh
complete -F _known_hosts ssh-installkeys

smeatonj ~/Development
$ sshfs <TAB>
Display all 387 possibilities? (y or n)

smeatonj ~/Development
$ complete -p | grep ssh
complete -F _ssh ssh
complete -o nospace -F _sshfs sshfs
complete -F _known_hosts ssh-installkeys
complete -F _ssh autossh
complete -F _ssh slogin

smeatonj ~/Development
$ ssh <TAB>
Display all 387 possibilities? (y or n)

"tipc command<TAB>" should insert space

Hitting for example tipc socket<TAB> should insert a space and give tipc socket (i.e. a space after the trailing "t", not sure if it's visible here in browser), but currently doesn't; it does nothing. @rical, could you have a look?

make completion regression in 2.3

When invoked in a prepared PostgreSQL source dir, make completion no longer offers targets but falls back to filename completion. (https://bugzilla.redhat.com/show_bug.cgi?id=1352312)

The culprit is the 2nd hunk to completions/make in 4b209b0 -- if # * File is an is replaced with # File is an, the completion starts to produce good results again.

Reproducer files are available in https://scop.fedorapeople.org/bugs/make-completion-regression/make-completion-regression.tar

make completion: document how to improve relevance of results in huge Makefiles

(This is a follow-up on the discussion of #63 )

In the attached example, which is generated by Automake, the completion results contains lots of intermediate results (.o, .obj) files and the source files (.h, .cpp).

Here is the output (to reproduce, use huge_makefile_example.zip)

$ make 
Display all 2838 possibilities? (y or n)
aclocal.m4
all
all-am
am--fnord
am--force-recheck
am--refresh
attacks.cpp
attacks.h
auto_generated_cxx_root_runner__cxx.cpp
basic.cpp
basic.h
benchmark
benchmark-attacks.o
benchmark-attacks.obj
benchmark-basic.o
benchmark-basic.obj
benchmark-benchmark.o
benchmark-benchmark.obj
benchmark-bitbases.o
...

Improving the documentation about intermediate targets and noninteractive targets could help to understand how the user can improve the Makefile, so the non-relevant targets are not listed.

Completion script slowing down tmux startup

Every time I start tmux or open a new split/window there is a delay of about 7 seconds before the prompt appears. I'm pretty sure this is not about tmux misconfiguration, I've made a test with a blank .tmux-conf and the delay persists. On the other hand, commenting out the bit where I load bash-completion in my bashrc puts things back to normal.

This is not happening outside tmux.

Running Bash 4.3 and tmux 2.1 on OS X. Any help pointing me in the right direction would be much appreciated.

macos 10.9

I have some error

$ source /usr/local/share/bash-completion/bash_completion
-bash: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
-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 ...]

MacOS

$ system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: OS X 10.9.5 (13F1808)
      Kernel Version: Darwin 13.4.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal
      Computer Name: MacBook Pro - Mirocow
      User Name: Mirocow (mirocow)
      Secure Virtual Memory: Enabled
      Time since boot: 14 days 23:22

User

$ id
uid=501(mirocow) gid=20(staff) groups=20(staff),501(access_bpf),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),401(com.apple.sharepoint.group.1),33(_appstore),100(_lpoperator),204(_developer),398(com.apple.access_screensharing),399(com.apple.access_ssh)

Bash version

$ --version
GNU bash, version 4.3.42(1)-release (x86_64-apple-darwin13.4.0)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Missing wildcard support

given e.g. a directory with

graphviz-gvedit.spec
graphviz-plugins.spec
graphviz-smyrna.spec
graphviz.spec

ls *spec

does not work. That is that _longopt does not support wild cards nor the completion options are used to do that if _longopt does not return anything.

ssh: please don't complete hosts found after Hostname in .ssh/config

When there is a host configuration in ~/.ssh/config that's probably because some options should be applied when connecting to this host. So it's only sensible to complete names after "Host", but not after "Hostname" because when using the latter the options are not applied.

This is also reported to the Debian bugtracker as Bug 689585

Tests use completion files in home directory

When preparing a patch, I had unexpected test failures, which I tracked to bash-completion using BASH_COMPLETION_HOME_DIR. Presumably the test suite should clear that variable before running tests.

"tar tvf" and "tar xvf" do not autocomplete filenames since 2.2

[rworkman@liberty testdir]$ tar -tvf test.tar.gz
drwxr-xr-x rworkman/rworkman 0 2016-03-14 17:11 testdir/
-rw-r--r-- rworkman/rworkman 0 2016-03-14 17:11 testdir/file1
-rw-r--r-- rworkman/rworkman 0 2016-03-14 17:11 testdir/file3
-rw-r--r-- rworkman/rworkman 0 2016-03-14 17:11 testdir/file2
[rworkman@liberty testdir]$ tar tvf te
tar: te: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
[rworkman@liberty testdir]$ tar xvf te
tar: te: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

Source user's .bash_completion.d

Hello and thanks for this awesome project!

I was wondering if it is a good idea to source files from $HOME/bash_completion.d as well.

I have a couple of examples where I need to keep the files local to a single user with no access to /etc.

I know I have a single file in ~ but the script come separate and I'd like the idea to just dump stuff in a folder like in /etc.

Thanks a lot for your (and contributor's) work!

Unexpected EOF if $( preceded by anything

Commands like the following:

cat $(find ../<TAB>

will cause bash-completion to fail with unexpected EOF while looking for matching ')'. This is bash-completion 2.1-5 on Archlinux.

README contains incomplete instructions for installation when starting from the git repo

The README says

If you don't have the package readily available for your distribution, or you simply don't want to use one, you can install bash completion using the standard commands for GNU autotools packages:

make
make check # optional, requires dejagnu and tcllib
make install # as root

but if you clone this repository, you won't find a ./configure in there.

There are two ways to improve this situation:

  1. Point the user to release tarballs that presumably have configure
  2. Tell the users to run autoconf after git clone, so a ./configure will be generated from configure.ac

I would prefer method 1, since I'm currently dealing with an RHEL machine without bash completion and with a really ancient autoconf that fails the version check.

man: not all man pages are listed if MANPATH environment is set

If MANPATH environment is set, only man pages located under directories specified by MANPATH are shown.

e.g.,

$ echo $MANPATH
/usr/share/man/openmpi-x86_64:/usr/share/lmod/lmod/share/man::
$ man ma(tab)
(no output)
$ man MPI(tab)
MPI
MPI_Abort
(snip)

$ unset MANPATH
$ man ma(tab)
mac2unix
machinectl
(snip)
$ man MPI(tab)
(no output)

As explained in manpath.1

If $MANPATH is set, manpath displays its value rather than determining it on the fly. If $MANPATH is prefixed by a colon, then the value of the variable is appended to the list determined from the content of the configuration files. If the colon comes at the end of the value in the variable, then the determined list is appended to the content of the variable. If the value of the variable contains a double colon (::), then the determined list is inserted in the middle of the value, between the two colons.

I think in the completion for man should use the output of manpath command.

I found this issue on Fedora 24 with Lmod package.

RubyGems support

It would be nice if bash-completion supported RubyGems. I just opened ticket with the script in RubyGems issue tracker, but since I am not sure where is the better place, I'll link it here as well, so I'll possible have feedback from both sides. Thx

[1] rubygems/rubygems#1627

tipc completion error

Just some random poking around tipc completion: tipc lin<TAB>ge<TAB>tol<TAB> gives tipc link get tolerance. Then hitting another tab there gives tipc link get tolerance link, and hitting another tab there spews an error:

error: No such file or directory
Unable to get TIPC nl family id (module loaded?)
error, message initialisation failed

This is on Fedora 23, non-root. @rical, could you have a look?

IFS='*' freezes bash

If you set IFS='*' then try tab completion, bash freezes and uses 100% CPU. The only way to stop it is kill -9.

I'm using Fedora 24 and bash-completion 2.3.

_file prepends "argetm" to symlinks

When completing files using _file, entries that are symlinks are prepended with "argetm" and a tab that ruins the column spacing. This seems to be because my LS_COLORS has ln=target, which indicates that symlinks should be colored the color of their target. What appears to happen is that it tries to print \e[targetm as opposed to \e[01;36m for eg, and \e[t expands to a tab character, and the rest is simply printed in front of the file name. This only happens when listing files in a directory, not when adding actual text to the command.

Reproducing:
dircolors -p >> ~/.dircolors if it doesn't already exist
edit .dircolors so that ln=target
if your .bashrc evaluates .dircolors (the default bashrc does), source your .bashrc, otherwise, run eval "$(dircolors -b ~/.dircolors)"
make sure there's a symlink in the current directory. it doesn't matter if it's dangling or not
use tab completion to list the files in the current directory, e.g., file <tabx2>
the symlink should have "argetm" at the front of its name and a tab before it, changing the column spacing

vi tab completion doesn't work, if an file named "!" exists

I am on Ubuntu 16.04 LTS latest update. Among others I reinstall: aptitude reinstall bash-completion and I restored .bashrc: cp /etc/skel/.bashrc ~/..
The issue:
If a directory contains a file named "!" (exclamation mark), the vi tab completion shows only directories and no files. The tab completion works correct with commands like rm, cat, tail or more (even if a file named "!" exists in the directory). You can easily reproduce the issue.
Is this a problem of bash-completion?

SOLUTION:
The problem is solved by using the latest git in here!
@christian Brabandt: Thanks for the help!

Completion for killall doesn't work

The completion for killall has a number of issues, one of them is the linux kernel 16-byte process name limitation.
Also, processes started from a directory with a space in their name, or with a space in their process name, fail.

I haven't really looked into how to write bash completion scripts, but here's how you could get a better process name list:
cut -z -d "" -f 1 /proc/*/cmdline | xargs -0 -n1 basename

-bash: 404:: command not found after installation

I just installed it on a fresh MacOS 10.12.1 with brew and the only lines in my ~/.bash_profile are

if [ -f $(brew --prefix)/etc/bash_completion ]; then
    . $(brew --prefix)/etc/bash_completion
fi

the output in a new terminal is -bash: 404:: command not found
I'm not sure how to fix this or what went wrong :/

alias completion broken

Hi,

i've been tinkering with aliases lately and noticed some strange behavior when it comes to tab completion:

my (demo) ~/.bash_completion looks like this:
complete -F _git gitalias

when i type
gitalias <tab>
i get gitalias bash: completion: function '_git' not found

but
git <tab>
prints the expected stuff.
Also when i type gitalias <tab> again, bash finds _git and prints the expected output.

I am using bash-completion v2.3
Do you need more info? Am I doing something wrong or is this a bug?

long option support for tar broken with version 2.4

Try

tar --create --file test.tar <TAB>

does show only option but no files nor directories

tar --create -f test.tar -<TAB>
-A -c -d -r -t -u -x

... the same for mixed options

tar --create -f test.tar <TAB>
tar --create f test.tar <TAB>

ssh: Test suite failure in Travis

https://travis-ci.org/scop/bash-completion/builds/109218638

Running ./completion/ssh.exp ...
FAIL: First argument should complete partial hostname
^C
/@_known_hosts_real ''''; echo_array COMPREPLY
::1
192.30.252.129
192.30.252.129
192.30.252.141
192.30.252.141
192.30.252.149
fe00::0
ff00::0
ff02::1
ff02::2
gist.github.com
gist.github.com
github.com
github.com
ip6-allnodes
ip6-allrouters
ip6-localhost
ip6-localnet
ip6-loopback
ip6-mcastprefix
localhost
localhost
ssh.github.com
testing-worker-linux-docker-849ac67d-3370-linux-3
testing-worker-linux-docker-849ac67d-3370-linux-3.prod.travis-ci.org
/@echo $?
0
/@ssh localhost FAIL: First argument should complete partial hostname

Not quite sure what the test is expecting, not just one "localhost" completion?

dequote function allows to execute arbitrary commands

I'd like to report a security issue with the dequote function inside bash, since it uses eval it allows to execute commands from the parameters passed to it. The name suggests it should only dequote and it could create security issues if somebody trust that it only does that. I'll be reporting the issue to OSS-SEC list and request for a CVE identifier which you can use when a new release is available.

# dequote  "hola"
hola
# dequote ';id'
uid=0(root) gid=0(root) groups=0(root)

Credit: Marcelo Echeverria, Fernando Muñoz

This issue was first identified on 2014 [1] but nobody cared to report it here.

[1] https://lists.gnu.org/archive/html/bug-bash/2014-04/msg00058.html

make completion is slow for huge Makefiles (generated by Automake)

(This is a follow-up on the discussion of #63)

For huge Makefiles, as generated by Automake, bash completions becomes very slow (>10 seconds).

To reproduce, use huge_makefile_example.zip. Completion for make should take several seconds. On my machine, it takes about 4 seconds for the call to "make", and additionally more than 10 seconds for the call to "sed".

The archive also contains the Make database generated by

__BASH_MAKE_COMPLETION__=1 make -f Makefile -npq .DEFAULT 2>/dev/null 1>Makefile.db

[RFE] allow easier reload of completions (upon updating/adding completion file)

My assumption was that after a package update that brings along it's own
completion file

source /etc/profile

would do the trick automatically in the current ssh session.

Unfortunately, that's not the case, because of
https://github.com/scop/bash-completion/blob/2.3/bash_completion.sh.in#L1:

# Check for interactive bash and that we haven't already been sourced.
if [ -n "${BASH_VERSION-}" -a -n "${PS1-}" -a -z "${BASH_COMPLETION_COMPAT_DIR-}" ]; then

where BASH_COMPLETION_COMPAT_DIR is marked as readonly variable, hence cannot be redefined/unset in the current shell session.

So while one could apparently do:

exec "$0" "$@"

it does not seem particularly appealing nor practical.

Is there a way to make bash-completion more reload-friendly?

linux apt-get install no candidate package,but apt-get remove working normal!

I install bash-completion by apt-get install by apt-get install bash-completion,and then I set source /etc/share/bash-completion/completion in ~/.bashrc ,apt-get inst + tab will become apt-get install ,but
when I type apt-get install mysql+tab ,no candidate package for example mysql-server ;I hava run apt-get
update before!I am so depressed!can you give me some suggestion!

Strange envrionment entry

Hi,

After sourcing /usr/share/bash-completion/bash_completion from bash-completion_2.1-4.3_all.deb my environment contains the entry "'><;|&(:. That prevents me from using dbus-update-activation-environment --systemd --all or systemctl --user import-environment.

Add completion for android tools

Thanks for starting adb completion file.

I've been using this completion that worked very well for me https://github.com/mbrubeck/android-completion

I see that @mbrubeck completion covers more use-cases than the one in this repo. Is it possible that you look at mbrubecks code and pull moreadb` use-cases?

There is also fastboot completion. Could you please add or pull mbrubeck's fastboot completion?

Installation location

Running on Ubuntu 16.04, the expected installation paths are different. For example

  • bash_completions was installed to /usr/local/share/bash-completion/bash_completion rather than /usr/share/bash-completion/bash_completion
  • Had to manually copy bash_completions.sh to etc/profile.d/

allow user to complete filenames after 'set --'

User wishes to have filenames completed when hit hits TAB at

$ set -- filena<TAB>

however he is thwarted.
The only choices are

$ set -- <TAB>
allexport             functrace             interactive-comments  noglob                physical              vi
braceexpand           hashall               keyword               nolog                 pipefail              xtrace
emacs                 histexpand            monitor               notify                posix
errexit               history               noclobber             nounset               privileged
errtrace              ignoreeof             noexec                onecmd                verbose

Pray tell what good are they after --?

Why can't you let me complete filenames anymore?

bash-completion:
Installed: 1:2.1-4.3

Unable to checkout repository on Windows

Checking out the repository using Git for Windows produces the below error:

$ git clone 'https://github.com/scop/bash-completion.git'
Cloning into 'bash-completion'...
remote: Counting objects: 22529, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 22529 (delta 2), reused 0 (delta 0), pack-reused 22519
Receiving objects: 100% (22529/22529), 3.27 MiB | 1.00 MiB/s, done.
Resolving deltas: 100% (16332/16332), done.
Checking connectivity... done.
fatal: cannot create directory at 'test/fixtures/_filedir/a"b': Invalid argument
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

I reported it on git-for-windows#828 but they pointed out that the repository contains files that are invalid on Windows.

These files are used in tests. Can these files be generated during the tests instead of being committed to the repository?

cryptsetup completion out of date

What's the update process - is there a maintainer for a specific app like cryptsetup to be pinged here, or just open a pull request personally?

Conflicts with CLICOLOR_FORCE

(The following has to do with the version of bash-completion that ships with OS X homebrew; apologies if it's not relevant to current versions.)

Various aspects of the completion scripts conflict with CLICOLOR_FORCE, an environment variable which forces ls to output terminal colour codes even when not obviously running interactively (useful for piping through less, etc).

The most glaring issue is in the have() function, which fails so that none of the completions get set up, but this only needs to happen when the bash-completion script is run, so can be fixed by setting the variable later on in the startup. But some of the scripts (e.g., for ssh) seem to rely on ls to generate filename lists on-the-fly which means that they come out mangled. For example:

$ scp .bas<tab>
^[\[34m.bash_sessions^[\[39\;49m^[\[0m/
.bashrc 

(Minor update: I've realised that for my own use case, which is really limited to needing CLICOLOR_FORCE for only one command, I've just added CLICOLOR_FORCE=1 into the function defined for it, so I don't need it globally. But this is still a minor bug, I think...)

`_command_offset` allows completions on bash built-ins

When fixing the completion function for ccache, it was pointed out to me that it's possible to complete a shell built-in (e.g. read) for which there is no corresponding command. Obviously, this makes no sense for command wrappers such as ccache.

I'm not sure where the bug really is, but it seems to me that _command_offset, which is typically used in such cases, should ensure that builtins are not completed, by filtering out -b.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.