3.5 KiB
navigate
This repository implements a custom shell command for changing directories.
I implemented this program to learn rust (because I was put on a rust project at work) and because I have two major problems with bashs builtin pushd/popd/dirs:
- no option to suppress output on
pushd/popd - rotates stack when pushing to stack entry (with +/-)
features
push- save path to the stack and change to specified directorypop- pop one, or the specified amount of entries from the stack and move to the oldest onestack- display the stackbook- move to/add/remove/display bookmarks
Every shell has its own stack, saved in the file /tmp/navigate/<process-id>.
navigate checks for and deletes orphaned stack files on execution.
This program does not run background tasks, all state is stored in temporary or configuration files.
setup
navigate requires a setup
- clone the repository
- build crate
- add path to executable to shell environment, or copy the executable to a directory in the path variable (e.g.
/usr/local/bin) - source setup script
navigate_bash_setupfor convenience functions and bash completions
configuration
The behaviour of navigate can be configured in the file $XDG_CONFIG_HOME/navigate/navigate.toml.
It has the toml extension, but might not implement the full toml specification.
navigatewill check for the filedefault.tomlin the configuration directory and create it if not found. It contains all settings with default values and a short explanation. After an update one can delete the file and call any subcommand ofnavigateto get an updated default configuration.
The lines without type and value are categories and need to be defined as toml table ([table]) in the configuration file.
Options are written as value = key.
Style settings accept styles and one color separated by commas.
Make sure to wrap the whole string in single or double quotes.
The following formats are supported:
- styles:
bold,dim,italic,underlined,blinking,reversed,invisible,strikethrough - named color:
black,red,green,yellow,blue,magenta,cyan,white - numbered color:
16..255 - rgb color:
#rrggbb
Note
: The styles and colors are applied as ansi escape sequences and your terminal may not support some of them.
todos
- replace
std::io::Errorwiththiserror::Error - option to pop several entries at a time and option to pop the entire stack
- drop stack
- config file
- implement procedural macro for config
- .. to parse config
- .. to write default config
- .. ignore comments in config file
- parse config file
- apply config -- partially more done than before :)
show-bookmarks-on-book
- setting for separator string when displaying stack/bookmarks
- color option for punctuation (mostly '/')
- option to dedup stack entries
- option for behaviour when jumping to stack entry via
push =<n>
- implement procedural macro for config
- bookmarks
- do not resolve links in bookmarks
- option to show invalid paths
- style option for invalid paths
- subcommand to remove invalid paths
- print deleted bookmarks
- consistent output of
removesubcommand
- push to push path in stack
- write documentation
- change config file extension to
.toml - add bash completions
- option to show home directory as '~'
- apply arguments or delete them..