Hey All,
I developed a new builtin and I was wondering what is the process for
getting it added to the official release (e.g. reviews, votes, etc).
*Pull Request:*
https://github.com/jstein916/bash/pull/1
*What the command dh does:*
it adds a new command called "dh" which stands for directory history. The
new command is similar to history but deals exclusively with the
directories that have been cd to. It creates a .bash_dirhistory file
similar to history.
*Help from bash:*
dh: dh [-ciw] [-m N] [N|partial_name]
Directory history navigation.
Display the directories that have been visited using the cd command,
ordered by frequency of access. Directories are numbered with the most
frequently accessed directory having index 1 (displayed last in the
list).
Options:
-c clear the directory history
-i show visit counts in parentheses
-m N limit display to N most recent directories
-w write directory history to file
Usage:
dh display directory list
dh -i display directory list with visit counts
dh -m 10 display only the 10 most recent
directories
dh -w save directory history to file
dh N change to directory number N from the
list
dh N-M change to directory number N, then go
up M levels
dh partial_name change to directory matching
partial_name, or show matches
Examples:
dh 5 change to the 5th directory in history
dh 5-2 change to the 5th directory, then go up
2 parent directories
dh -m 5 -i show only 5 most recent directories
with visit counts
dh proj change to directory containing 'proj'
in its basename
dh bash change to directory containing 'bash',
or show all matches
Exit Status:
Returns success unless an invalid option is given.
*Examples:*
Jason@PC MSYS /c/Projects/bash
$ cd /tmp/test1
Jason@PC MSYS /tmp/test1
$ cd /tmp/test2/
Jason@PC MSYS /tmp/test2
$ cd /tmp/test3
Jason@PC MSYS /tmp/test3
$ dh
3 /tmp/test3
2 /tmp/test2
1 /tmp/test1
Jason@PC MSYS /tmp/test3
$ dh 31
bash: dh: directory number 31 out of range (1-3)
Jason@PC MSYS /tmp/test3
$ dh 1
/tmp/test1
Jason@PC MSYS /tmp/test1
$ dh test3
/tmp/test3
Jason@PC MSYS /tmp/test3
$ dh
3 /tmp/test3
2 /tmp/test2
1 /tmp/test1
Jason@PC MSYS /tmp/test3
$ dh 2-1
/tmp
Jason@PC MSYS /tmp
$ dh tmp
Multiple matches found:
1 /tmp/test3
3 /tmp/test2
2 /tmp/test1
Thanks
Jason