The best README is probably the test cases:
#[test]
fn it_works() {
assert_eq!(tico("~"), "~");
assert_eq!(tico("/"), "/");
assert_eq!(tico("/home/hugopeixoto/work/personal/tico"), "/h/h/w/p/tico");
assert_eq!(tico("~/work/personal/tico"), "~/w/p/tico");
assert_eq!(tico("~/work/personal/tico/"), "~/w/p/t/");
assert_eq!(tico("~/work/ééé/tico"), "~/w/é/tico");
}
$ cargo install --git [email protected]:portocodes/tico.git
Here's how I'm using it in fish_prompt.fish
to replace prompt_pwd
:
set -l cwd $cyan(tico (echo $PWD | sed -e "s|^$HOME|~|"))