Very nice.
I use a set of bash functions to do the same thing, with tab-autocompletion (not my own development, I picked it up from the web somewhere long ago). Put this in your .bashrc:
# mark/jump support + completion
# un/mark name : bookmark a directory or remove one (unmark)
# jump name : jump to directory
# marks : show all bookmarks
export MARKPATH=$HOME/.marks
function jump {
cd -P $MARKPATH/$1 2>/dev/null || echo "No such mark: $1"
}
function mark {
mkdir -p $MARKPATH; ln -s $(pwd) $MARKPATH/$1
}
function unmark {
rm -i $MARKPATH/$1
}
function marks {
ls -l $MARKPATH | sed 's/ / /g' | cut -d' ' -f9- | sed 's/ -/\t-/g' && echo
}
_completemarks() {
local curw=${COMP_WORDS[COMP_CWORD]}
local wordlist=$(find $MARKPATH -type l -printf "%f\n")
COMPREPLY=($(compgen -W '${wordlist[@]}' -- "$curw"))
return 0
}
complete -F _completemarks jump unmark
I was using $OLDPWD and your solution is much shorter, cheers. Both also work in my shell, Fish. Perhaps obvious, but it is also possible to use cd - twice to get back to orig.
I recently learned that this trick also works with merge. `git merge -` merges the last branch you were on onto the current one. So far i've found it very useful :)
I think the point of the linked page is to show how to implement a command line app in Haskell. Teleport is just an example, as such it doesn't really have to be a great tool for everyday usage.
On the other hand, teleport seems to actually provide a much better UX than pushd/popd:
1. it's a hash-table not a stack (directories are named), so it allows random access to memorized directories.
2. it is possible to display the current state.
3. remembered directories are persistent between shell sessions.
And yes, the primary goal of writing this was to have a small CLI app in Haskell, but I've found that I use teleport a decent amount now to quickly zip between common folders
Main eshell advantage is tramp integration. I can "cd /computer:" to change my directory to remote machine. From there, I can open a file as though it were local. Grep opens results in a buffer that acts as an index to the results. And my magit shortcut acts correctly.
Meant to clarify, I was not defending pushd/popd. It is a tough experience. Not a tough experience to beat. And pedagogical is a perfectly fine motivation.
i am not yet convinced on literate Haskell besides tutorials. It makes the source-code hard to read and understand, too much noise for this little amount of source-code.
Of course you can. Inside .bashrc you have access to aliases (a facility to name things) and to a Touring-complete programming language (a tool to make things). There is little you can't do in .bashrc
because
1. it's a nicer UI that does the same thing.
2. the goal of the tool was to be minimal, useful, and a way to show off Haskell's ability to be able to write real world code that beginners can understand.
3. (personal opinion) Haskell is way more maintainable than bash is, any day of the week.
That's not how copyright / trademarks work. Try and name your software Photoshop Kids or Photoshop Palette. Adobe's lawyers will rip you a new one quite quickly if you attempt to tell them "it has nothing to do with editing images".
Intellectual property law is complex and trying to sum it up in a sentence or two is going to give people the wrong impression. However, as much as I'm not a lawyer, I will try to help you dispel a few notions.
First, this is a clearly a trademark issue, not a copyright issue. You can't copyright a name. In fact there are many, many, many things that you can't copyright. It often happens that people conflate the 3 main areas of intellectual property law: copyright, trademarks and patents, but it is quite important that you distinguish between them precisely.
WRT to trademarks, having a similar name is not enough to cause a trademark infringement. It also needs to create confusion in the marketplace. In this case, a tutorial on how to make a command line Haskell app and some kind of web service is really unlikely to cause any confusion.
The problem with trademarks is that, unlike copyright, if you have a trademark you have to defend it or lose it. So if you sue someone over a trademark infringement, the other side can say, "Well, they didn't say anything about this other guy doing the same thing even though they knew about it". This can cause you to lose the trademark.
Because of this, many lawyers err on the side of caution and send out spammy "You are infringing on our trademark" notices to everyone. If you send a quick note back saying, "I don't think there is any possibility of confusion in the market place" (such as this situation), the lawyers will often back off -- unless they truly believe that there is a problem.
Clearly your advice of trying to avoid trademark infringement is good advice. In this case, though, here is pretty clearly no infringement, so it's misplaced. In the very unlikely even that a lawyer asks about it, replying back with the response, "There is no chance for confusion in the market place" will likely be enough (Note: this is not legal advice, and I am not a lawyer).
Interesting side track: The World Wrestling Federation (WWF) became World Wrestling Enterprises (WWE) due to a trademark dispute with the World Wildlife Foundation (WWF). You could reasonably think that there is no way of confusion in the market place, but the World Wildlife Foundation showed that people were hesitant to contribute to them because they actually thought that they were associated with the World Wrestling Federation. That is the key issue, not just the similarity in the name.