Tuesday, March 2, 2010

Man-page based Bash Completion

Hacked up this little function which you can use to get generic bash completion on any command based on the man page. You just need to source this file. Here's what it looks like when executed
mingus:~ 03:16:45 
$ wget --c[TAB]
--ca-certificate=file      --certificate=file         --convert-links
--ca-directory=directory   --connect-timeout=seconds  --cut-dirs=number
--certificate-type=type    --continue                 
Theoretically you could take this a step further and complete the values of the options as well. Many of the options say "--foo=file", "--foo file", "--bar host", etc.. You could parse out this "file" or "host" keyword and switch the completion style accordingly. If you 'apt-get install bash-completion' you'll get a ton of completion functions which specialize in host, file, and directory completion. Shouldn't be too hard to wire them in. If anyone gets the urge to do it, definitely share your results. The above code is stored in gist.github.com, so fork away!

13 comments:

voyeg3r said...

Awesome script! I mix lot tips and tricks about complete mixing portuguese and english in this post:
http://vivaotux.blogspot.com/2010/08/bash-melhorando-complementacao-de.html

Thanks!

voyeg3r said...

How to get complete for aria2c command?

Narender Godara said...

Packers and movers Nashik
Packers and movers Navi mumbai
Packers and movers Noida
Packers and movers Panchkula

amine lahragui said...

Your work is very good and I appreciate you and hopping for some more informative posts. happy new year 2016 new year 2016 bonne année 2016 happy new year 2016 images feliz año nuevo 2016 imagenes de año nuevo 2016 feliz año 2016

Deepak Negi said...

Hey Guys Must Check these :-

I can do that live show
I can do that live telecast
I can do that Show live streaming
muharram 2015 Images
muharram 2015 Hd Wallpapers
Happy muharram 2015 Quotes
Muharram 2015 Slogans
muharram 2015 Karbala sms
Muharram 2015 Quotes
10 muharram 2015 Talwar Matam Videos
Muharram 2015 Zanjeer Juloos Videos
muharram 2015 Poems
Hazrat Hussain Poetry 2015
muharram 2015 Qawwali Mp3
10 Muharram 2015 shayari
Muharram 2015 Status
Labbaik ya hussain mp3 Songs
Hazrat Hussain Hd Images
Happy Childrens Day 2015 Images
Mastizaade Box Office Collection
Mastizaade Funny Scenes
Mastizaade hd Videos
Mastizaade Hot Scenes
Mastizaade Movie Review
Mastizaade Romantic Scenes
Mastizaade Songs
Mastizaade trailer film
World Aids Day 2015 Quotes
World Aids Day 2015 Posters
World Aids Day 2015 Themes
World Aids Day 2015 Slogans

Mary Brown said...

Java EE article is practical oriented and real time examples. How Java EE address the enterprise development is very important. for that you need a practical orieneted Java Training you need.

Online Java Training
Online Java Training from India
Java Training Institutes in Chennai
Java Training in Chennai
Java Training

Ranveer Patil said...

This is great do you have a catologue if so I would love one to share with friends and family.
ICC T20 World Cup 2016
Australia vs India time table

jasmine kaur said...

Super Bowl commercials 2016
best super bowl commercials
2016 Super Bowl Commercials
Super Bowl Commericals
Super Bowl halftime show 2016
Super Bowl 50
super bowl 50 tickets
super bowl halftime show
Super Bowl halftime show 2016
Super Bowl 50
super bowl 50 tickets
super bowl halftime show
Super Bowl commercials 2016
best super bowl commercials
2016 Super Bowl Commercials
Super Bowl Commericals

jawad zaib said...

Your Site Is Very Good and The Post is Well On Topic, Thanks for Sharing it with us.

New Songs 2016
the biggest attraction of the Samsung event
Samsung Galaxy S6 Edge Plus
Zaid Ali’s wedding photos goes viral
apple iphone 7 key note
Islamabad United Pakistan Super League 2016
poetry urdu sad 2016
New Sad Songs 2016
Shayari on dosti 2016

Rahul Bhatia said...

Watch ICC T20 World Cup 2016 Live Streaming, Live Telecast Of World T20 2016 India, India Vs Pakistan, India Vs Australia Watch Online, T20 World Cup Live Streaming Free.
t20 world cup 2016 live telecast channel india

t20 world cup 2016 coverage india

icc t20 world cup 2016 live streaming star sports

t20 world cup 2016 live score ball by ball

varun singh said...

Hello dear .You put really very helpful information.
It’s pretty worth enough for me. In my opinion, if all webmasters and bloggers made good content as you did, the web will be a lot more useful than ever before.

t20 world cup live stream
ipl live streaming
ipl 9 live streaming
real madrid vs barcelona live streaming
La Liga Live Streaming
India vs Pakistan T20 Live Streaming
India vs Pakistan T20 Live Streaming Asia Cup 2016

varun singh said...

Hello dear .You put really very helpful information.
It’s pretty worth enough for me. In my opinion, if all webmasters and bloggers made good content as you did, the web will be a lot more useful than ever before.

t20 world cup live stream
ipl live streaming
ipl 9 live streaming
real madrid vs barcelona live streaming
La Liga Live Streaming
India vs Pakistan T20 Live Streaming
India vs Pakistan T20 Live Streaming Asia Cup 2016

[Leader] said...

happy valentines day images
happy valentines day pictures
happy valentines day funny
happy valentines day pics

valentines day ideas
valentines day quotes
valentines day cards
valentines day poems

happy valentines day card
happy valentines day photos
valentines day gifts for him
valentines day gifts for her

ssc result 2016
t20 world cup 2016 schedule
ipl 2016 schedule
How to Get Rid of Freckles
ssc result 2016
Happy New Year 2017
UP SCHOLARSHIP
whatsapp status love
2016 UEFA European live stream