Credit the source of the idea behind the descriptive names appropriately
Closed this issue · 3 comments
Please see this web archived'd post as evidence of assertions below: https://web.archive.org/web/20110219003435/http://www.huyng.com/archives/quick-bash-tip-directory-bookmarks/492/
The original article link above has been scrubbed, not sure why. The github project instead links to this article: https://everyhue.me/posts/bashmarks-directory-bookmarks/ - which makes no reference to who proposed a key improvement.
The original script by Huy essentially fixed the bookmark label names to m1
to m9
. What I did (as can be seen in the comment section of the web archived link):
- Provided a way for descriptive bookmarks (including no name as an easy default)
- Gave the idea to use bash TAB completion
Below is my comment in entirety (posted 10-Feb-2010):
I did the following to give descriptive bookmark names:
function s {
cat ~/.sdirs | grep -v "export DIR_$1=" > ~/.sdirs1
mv ~/.sdirs1 ~/.sdirs
echo "export DIR_$1=$PWD" >> ~/.sdirs
}
function g {
source ~/.sdirs
cd $(eval $(echo echo $(echo \$DIR_$1)))
}
function l {
source ~/.sdirs
env | grep "^DIR_" | cut -c5- | grep "^.*="
}
Mnemonics:
s – Save directory (argument is a shorthand bookmark name)
g – Go to directory
l – List saved directories
Usage:
$ cd /foo/bar/some/dir
$ s mybookmarkname
…
In an other shell:
$ l
mybookmarkname=/foo/bar/some/dir
$ g mybookmarkname
should take you to /foo/bar/some/dir
Obviously you’ll use far less characters than the 14 used in “mybookmarkname”..
Incidentally, it is also ok to leave the bookmark name..
$ cd /foo/bar/some/dir
$ s
…
In an other shell:
$ l
=/foo/bar/some/dir
$ g
should take you to /foo/bar/some/dir
And as a follow-up comment on the same day, I also mentioned:
Btw, it is also possible to use TAB completion on bookmark names using compgen/complete in bash.. so doing something like:
$ g my
should complete to
$ g mybookmarkname
This was Huy's response to above (he implemented the TAB completion script):
Karthick,
Amazing ! This is way better than my implementation. The snippet below adds tab completion to your script.
(followed by the snippet)
When I provided the feedback, the code didn't exist as a project on github. As can be seen, the original code from Huy was never used in the bash bookmarks - it was the code given in my comment that has been used.
I'm requesting the maintainer of the project to credit me (Karthick Gururaj) appropriately in the project README.
@karthick-gururaj I move my site and, your comments along with other people's comments are still on the page linked in the article. Just click on the "show comments"
Here's a branch I will merge if this looks good with you (or let me know if you want me to link to a different website other than your github account):
https://github.com/huyng/bashmarks/tree/creators?tab=readme-ov-file#creators
-H
Thanks @huyng ! Above proposal looks good to me.