開発
Shell convenience
denvazh
I like working in command-line environment and its often nice to have nice tools, that supports such way of work.
Few month ago, I was told by Sascha about interesting shell, that is very colorful and have quite a lot of nice features.
It’s name was fish ( homepage is here ).
Unfortunately, this project was no longer getting any updates, so some people forked it and continued add new functions and brushing up existing ones ( https://github.com/fish-shell/fish-shell )
Fork name was named fishfish, which development team hopes to eventually change to just fish.
How does it look like?
It has a lot of nice features. When you start typing some command and then hit Tab key, it will show suggestions along with simple description:
denvazh@somehost ~> git git (The stupid content tracker) git-flow (Executable link, 3.5kB) git-jautf8/ (Directory) git-upload-archive (Send archive back to git-archive) git-credential-osxkeychain (Executable link, 13kB) git-hg (Executable link, 2.6kB) git-receive-pack (Receive what is pushed into the repository) git-upload-pack (Send objects packed back to git-fetch-pack) git-cvsserver (A CVS server emulator for git) git-jautf8 (Executable, 4.6kB) git-shell (Restricted login shell for Git-only SSH access) gitk (The git repository browser)
Also, when you’re typing it will highlight text in red if it cannot find the command ( or any command related to the input ), and green for cases when it was able to find anything.
Let’s install
For managing command-line tools on OS X I recommend using Homebrew (https://github.com/mxcl/homebrew).
It is very well maintained and very-very easy to install and use. Moreover, everything is organized with git and ruby, which is a total bliss for any decent ruby developer 🙂
It is possible to install original ( and quite old ) fish-shell with:
$: brew install fish
However, I do not recommend doing it, mainly because even development version of the fishfish is a way better. It is always possible to install it from source-code, but in this case Homebrew is not used and
when you’d want to make certain changes ( like re-build/re-install/un-install ), you have to do it by hands.
To be able to use brew, we have to create custom Formula specifically for fishfish.
I created custom formula to build fishfish from the tar.gz archive of the latest tag of the project in github.
Because, there might be clashes with the old one, I put it in the formula fishfish.rb ( whereas fish.rb is of original old fish ).
With github it was possible to fork entire Homebrew project and then add necessary changes.
Because, fork of the main project is also available globally, it is possible to install custom formulas with the direct link ( URL ) to the file.
$: brew install https://raw.github.com/denvazh/homebrew/master/Library/Formula/fishfish.rb
Very simple.
$: brew install https://raw.github.com/denvazh/homebrew/master/Library/Formula/fishfish.rb ######################################################################## 100.0% ==> Cloning https://github.com/fish-shell/fish-shell.git Updating /Users/denvazh/Library/Caches/Homebrew/fishfish--git ==> Checking out tag pre_fishfish ==> autoconf ==> ./configure --prefix=/usr/local/Cellar/fishfish/pre_fishfish --without-xsel ==> make install ==> Caveats You will need to add: /usr/local/bin/fish to /etc/shells. Run: chsh -s /usr/local/bin/fish to make fish your default shell. ==> Summary /usr/local/Cellar/fishfish/pre_fishfish: 468 files, 3.4M, built in 12 seconds
Using…
$: /usr/local/bin/fish Welcome to fish, the friendly interactive shell Type help for instructions on how to use fish
To be able to use it as default shell, it is necessary to add full link to the fish-shell binary to the default shell setup. This can be done with chsh command.
Enjoy!