Linux, programming, computers and life

December 7, 2007

bash completion for atool

Filed under: CLI, linux

More or less two years ago i wrote about atool. I finally managed to do something i wanted to do long ago - to create bash completion for it. In archlinux, create a file named /etc/bash_completion.d/atool, with the following code:

# atool(1) completion by linux4all.blogsome.com
_atool()
{
local cur

COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}

case “$cur” in
-*)
COMPREPLY=( $( compgen -W ‘-l -x -X -a -c- -d -r \
-e -F -D -f -q -v -p -o -E -S –list –extract –extract-to= \
–add –cat –diff –repack –each –format= –subdir –force \
–quiet –verbose –page –null –explain –simulate –config=’ — $cur ) )
;;
*)
_filedir ‘@(rar|RAR|zip|ZIP|tar.gz|tgz|tar.bz|tbz|tar.Z|tZ|tar.lzo|tzo|tar.7z|t7z|tar|jar|JAR|war|lha|lzh|7z|ace|ACE|arj|ARJ|a|arc|ARC|rpm|deb|gz|bz|bz2|Z|lzo|cpio)’
;;
esac

return 0

}
complete -F _atool -o filenames atool

and enjoy custom tab-completion for atool.

Technorati Tags: , , , , ,

Comments »

The URI to TrackBack this entry is: http://linux4all.blogsome.com/2007/12/07/bash-completion-for-atool/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.

Get free blog up and running in minutes with Blogsome
Theme designed by Gary Rogers