On 09/10/2011 11:49 PM, DJ Lucas wrote:
> Grub and GLib both install bash completion scripts. Need to add
> something to the default /etc/profile in the book to take advantage of them.
>
> Additionally, the one for grub is broken currently looking for a have()
> function, which for distros is usually defined in /etc/bash_completion.
And it gets worse: The gdbus one requires _get_cword() from a Debian 
package called bash-completion-lib. Grub requires 2 more from the same 
package: filelist(), _get_longopt(), and _filelist() is dependent on 
_expand(). There was a Google code project 
(http://code.google.com/p/bash-completion-lib/) that doesn't cover 
_split_longopt() (following). Last release was in Feb of 2009, but I 
haven't found where the Debian one is developed yet.


# This function splits $cur=--foo=bar into $prev=--foo, $cur=bar, making it
# easier to support both "--foo bar" and "--foo=bar" style completions.
# Returns 0 if current option was split, 1 otherwise.
#
_split_longopt()
{
     if [[ "$cur" == --?*=* ]]; then
         # Cut also backslash before '=' in case it ended up there
         # for some reason.
         prev="${cur%%?(\\)=*}"
         cur="${cur#*=}"
         return 0
         fi

     return 1
}

Just leave it unconfigured in LFS? I'll try and get something into the 
BLFS wiki, not sure whether the full package, or just the known needed 
functions. With just a base LFS, only 5 functions are required for bash 
completion to work as the developers intended.

-- DJ Lucas


-- 
This message has been scanned for viruses and
dangerous content, and is believed to be clean.

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to