help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] Query bash completion from shell script


From: Alex Cornejo
Subject: [Help-bash] Query bash completion from shell script
Date: Tue, 21 Feb 2017 10:22:24 -0800

The title says it all.

Example of hypothetical (desired) function:

get_completion "git a"
> add
> am
> annotate
> apply
> archive

get_completion "ls --a"
> --all
> --almost-all
> --author

There are various attempts to do it online, the most complete seems to be:

https://brbsix.github.io/2015/11/29/accessing-tab-
completion-programmatically-in-bash/

Unfortunately, they all seem to be buggy and/or incomplete. For instance,
the previous linked solution works with the 'git' example, but not with
'ls'. Also none seem to handle gracefully filename completion (i.e. 'git
add ' returns an empty list instead of a list of the files in the current
folder), etc.

Is there a robust solution to this problem? Could we add a hook to bash to
do this? is this the right mailing list to post this?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]