[Haskell-cafe] hquickfile first prototype ..

Marc Weber marco-oweber at gmx.de
Tue Jul 4 12:51:21 EDT 2006

I want your feedback..

The purpose of this program is to get the files/ directories you know faster.

Put this into your .bashrc:
Of course you have to adjust the executable filename.

============= .bashrc ==========================================================
alias F='/usr/bin/hquickfile'
	cd `/usr/bin/hquickfile "$@"`
============= end .bashrc ======================================================

The source can be found here: 

You need ghc, cabal, parsec and the FilePath library of Neil (Thanks for
assisting me!) http://www-users.cs.york.ac.uk/~ndm/projects/libraries.php

Things to try:
Q /t (equal to cd /tmp)
Q /usl (equal to cd /usr/src/linux)
.. you should get the idea by reading the help output:

============ hquickfile -h output =============================================
	Usage: hquickfile
	Get the file you want quickly.
	 hquickfile is not a new shell yet but a beginning.. ;)
	usage: you specify file patterns such as (explanation in bash glob syntax)
	  @vl which will match v.*/l.* (eg var/log on liunux)
	  :abc:def will match .*a.*b.*c.*/d.*e.*f.*
	  =abc will match abc exactly
	  prefix with / to start from root, not current directory
	  windows users have to use /c for c:, /d for d: .. (win not yet tested)
	  to take the first x directories as relative path to start from prepend x
	  to remove the last x directories prepend x-
	  eg cd is /home/marc/hq/ pattern 1-=foo will result in /home/marc/foo
				  pattern 1=foo  will result in /home/foo
	  (match file 1 with =1 or @1

	append '+' to add not yet existing parts eg you can do
	  mkdir -p `thisapp /@t+a/b/c` to create the /tmp/a/b/c directory
	  append / or : to match directories or files only
	you can use {blah,foo,...}/ab as you can do in bash which expands to
	  two arguments blah/ab and foo/ab
	 {a,b}{c,d} will expand to ac ad bc cd wheras
	 {a,b}foo[c,d] will expand to afooc bfood
	 {a,b}{c,d}[1,2,3.4] will expand to ac1 ad2 bc3 cd4

	you can add glob patterns:
	  ,a/*.txt will ask you wether you want all text files from abc/*.txt or abd/*.txt

	Because every key you have to type is important you can omit the leading @ 
	 so /ea is equal to /@ea
	would it be useful if small letters would also match capital letters but not the 
	other way round? The Eclipse Plugin GotoFile (written by Max Uermann) does it this way

	written by Marc Weber
	Credits to any other haskeller whose tools I've been using (Neil, Pesco, ..) !
	especially those on #haskell on freenode who have helped me a lot by listening
	  -h, --help               print this help
========== end hquickfile -h ================================================

I think there are still some bugs..

Marc Weber

More information about the Haskell-Cafe mailing list