#fish #minimalist #prompt #command #compression

app clanker

Minimalistic command prompt for fish

17 unstable releases (6 breaking)

0.7.0 Apr 15, 2020
0.6.0 Apr 15, 2020
0.5.3 Oct 17, 2019
0.4.3 Mar 10, 2019
0.1.2 Mar 5, 2019

#12 in #fish

42 downloads per month

AGPL-3.0-or-later

33KB
698 lines

clanker

Crates.io

Clanker is a theme for fish with a focus on minimalism.

clanker demo

Installation

cargo install clanker

Then place this in your config.fish or somewhere that will be sourced when fish starts up:

function fish_prompt
    set -g CLANKER_STATUS $status
    clanker-prompt
end

function fish_right_prompt
    clanker-right-prompt "$CLANKER_STATUS"
end

function fish_title
    clanker-title "$_"
end

Building From Source

git clone git@github.com:Gregory-Meyer/clanker.git
cd clanker
cargo build --release

You will then need to copy the binaries from target/release to somewhere in your PATH, like /usr/local/bin.

Usage

clanker-prompt

clanker-prompt outputs the current username, hostname, and compressed current working directory. There are two optional arguments -- the unpriviliged and priviliged line enders. These default to '>' and '#', respectively, but you may replace them at runtime using these arguments.

clanker-right-prompt

clanker-right-prompt prints the status of the last command in red if it was nonzero and some info the git repository the current folder is in. If the current directory is a git repository according to git_repository_open_ext(..., REPOSITORY_OPEN_FROM_ENV, ...), this program will print out some info about HEAD. If HEAD points to a branch, the name of that branch will be printed. If HEAD points to a tagged commit, the name of those tags will be printed. If multiple tags point to the same commit as HEAD, then the tags are delimited with a backslash ('\'). Otherwise, the shortened 7-digit SHA sum of the current commit will be output.

clanker-title

clanker-title optionally takes the currently running program as an argument and prints it along with the compressed current working directory.

Path Compression

Paths are compressed so that each compressed component is the shortest unique prefix of a filename in that path. A component will never be shortened to "." or "..". The last component in a path is never shortened. Components that do not represent a unique prefix at all are not compressed. Home directories of another user, like ~gregjm or ~root, are not compressed.

Dependencies

~11MB
~214K SLoC