[PATCH] ash: perform autocompletion on builtin commands
Matteo Croce
matteo at openwrt.org
Fri Nov 28 11:03:10 UTC 2014
Hi,
Just a refresh, any doubt about this patch?
2014-10-25 23:33 GMT+02:00 Matteo Croce <matteo at openwrt.org>:
> Yes, CONFIG_FEATURE_TAB_COMPLETION for generic completion and
> CONFIG_FEATURE_USERNAME_COMPLETION for home completion
>
> 2014-10-25 13:14 GMT+02:00 Sven-Göran Bergh <sgb-list+busybox at systemaxion.se>:
>>
>> Hi again,
>>
>> just want to roll over and apologies for the disinformation I may have
>> caused. I was heavily confusing my systems. I blame it on the weekend.
>>
>> ash does not used the same mechanism as bash, so it may not be extended
>> like bash. bash relies on the built-in command "complete" to configure
>> this while ash has it compiled in. Thus, ash only have the most basic
>> completions like directories, tilde and $PATH, but that is all I need,
>> so I'm happy with that.
>>
>> Forget all I said about bash in my previous post. Just make sure you
>> have CONFIG_FEATURE_TAB_COMPLETION=y when you build BB and you are fine.
>>
>> Sorry for the spam
>> /S-G
>>
>>
>> On 10/25/2014 11:05 AM, Sven-Göran Bergh wrote:
>>>
>>> Hi,
>>>
>>> On 10/24/2014 09:40 PM, John Spencer wrote:
>>>>
>>>> Sven-Göran Bergh wrote:
>>>>>
>>>>> Just source /etc/bash_completion in either .bashrc or .profile.
>>>>
>>>>
>>>> what would be the contents of this file, that make expansion of the
>>>> tilde work ? /etc/bash_completion is not installed on my box.
>>>
>>>
>>> Sure tilde expansion works.
>>>
>>> /etc/bash_completion is an ordinary shell script file containing
>>> instruction sets for the completions that you want. It is commonly used
>>> by bash. Personally I run debian, but I am sure most distros have it.
>>> In debian /etc/bash_completion is a symlink to
>>> /usr/share/bash-completion/bash_completion. It includes all files
>>> in /etc/bash_completion.d, so you can pretty much pick and choose what
>>> completions you want, or even write your own once.
>>>
>>> In my embedded project I only use a minimal /etc/bash_completion for the
>>> most basic stuff.
>>>
>>>> (just to make sure we're talking about the same thing:
>>>> $ ls ~/.s<TAB> should expand to ~/.ssh/ or /home/user/.ssh, but doesn't)
>>>
>>>
>>> # ls ~/.s<TAB> gives me ~/.ssh/
>>>
>>>> while we're at it, the other autocompletion thing ash doesn't support
>>>> out-of-the-box is expansion of directories in the first position on the
>>>> actual line.
>>>> for example i want to run utils/foo.sh
>>>> $ u<TAB>
>>>> doesn't expand to utils/, whereas
>>>> $ ./u<TAB>
>>>> does.
>>>
>>>
>>> Yes, it works exactly as i bash. It all depends on how may files you
>>> want in /etc/bash_completion.d/. Ex. in the kernel source tree on my
>>> system you can just:
>>>
>>> # make <TAB><TAB>
>>>
>>> and you get a list of all valid targets in the Makefile.
>>>
>>>> would be nice if this could be enabled using some trick.
>>>
>>>
>>> Check out the files .bashrc, .profile or their global cousins in /etc,
>>> in your working bash environment. Somewhere /etc/bash_completion
>>> (or something similar) is sourced. Study the structure and just transfer
>>> the parts you want to your ash environment. Then make sure you have
>>> CONFIG_FEATURE_TAB_COMPLETION=y when you build BB.
>>>
>>> Happy tweaking
>>> /S-G
>>>
>>>>> ash will pick it up and use it in the same way as bash.
>>>>> Have never had any problem with this. Works like a charm.
>>>>>
>>>>> Brgds
>>>>> /S-G
>>>>>
>>>>> On 10/24/2014 05:20 PM, John Spencer wrote:
>>>>>>
>>>>>> Matteo Croce wrote:
>>>>>>>
>>>>>>> Refactor read_line_input to accept a list of strings which are
>>>>>>> added byt the autocompletion suggestions.
>>>>>>> Let ash pass the builtin command list to read_line_input to enable
>>>>>>> completion of builtin commands as echo, printf, history, exec, etc.
>>>>>>
>>>>>>
>>>>>> nice. could this mechanism be used to expand ~ to the contents of $HOME
>>>>>> for autocompletion ? lack of this expansion is currently my major
>>>>>> annoyance with ash and the reason i still use bash...
>>>>>> _______________________________________________
>>>>>> busybox mailing list
>>>>>> busybox at busybox.net
>>>>>> http://lists.busybox.net/mailman/listinfo/busybox
>>>>>
>>>>>
>>>>
>>>
>>> _______________________________________________
>>> busybox mailing list
>>> busybox at busybox.net
>>> http://lists.busybox.net/mailman/listinfo/busybox
>>
>>
>>
>>
>> _______________________________________________
>> busybox mailing list
>> busybox at busybox.net
>> http://lists.busybox.net/mailman/listinfo/busybox
>
>
>
> --
> Matteo Croce
> OpenWrt Developer
> _______ ________ __
> | |.-----.-----.-----.| | | |.----.| |_
> | - || _ | -__| || | | || _|| _|
> |_______|| __|_____|__|__||________||__| |____|
> |__| W I R E L E S S F R E E D O M
> -----------------------------------------------------
> CHAOS CALMER
> -----------------------------------------------------
> * 1 1/2 oz Gin Shake with a glassful
> * 1/4 oz Triple Sec of broken ice and pour
> * 3/4 oz Lime Juice unstrained into a goblet.
> * 1 1/2 oz Orange Juice
> * 1 tsp. Grenadine Syrup
> -----------------------------------------------------
--
Matteo Croce
OpenWrt Developer
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
CHAOS CALMER
-----------------------------------------------------
* 1 1/2 oz Gin Shake with a glassful
* 1/4 oz Triple Sec of broken ice and pour
* 3/4 oz Lime Juice unstrained into a goblet.
* 1 1/2 oz Orange Juice
* 1 tsp. Grenadine Syrup
-----------------------------------------------------
More information about the busybox
mailing list