Crates.io | dalia |
lib.rs | dalia |
version | 1.2.0 |
source | src |
created_at | 2020-11-09 21:27:32.243158 |
updated_at | 2021-03-09 15:31:37.002145 |
description | A small utility for generating aliases to change directories without typing `cd`. |
homepage | https://github.com/wemgl/dalia |
repository | https://github.com/wemgl/dalia |
max_upload_size | |
id | 310483 |
size | 34,627 |
A small commandline utility for creating shell aliases to change directories quickly without needing to type cd
.
Dalia requires a configuration file in order to run properly. Dalia expects the configuration file to be at $HOME/.dalia/config
by default. The file should contain a list of absolute paths, and any optional custom names at the start of the line, to create all aliases.
Finally, all configured paths must be absolute paths—anything else is invalid.
Aliases can have a custom name assigned to them, just surround whatever text you want with square brackets ([
& ]
) and
include it at the beginning of the line. If dalia doesn't find a custom name for a particular directory,
then the alias will be the lowercase basename of the absolute path (e.g. /some/absolute/path
yields an alias named path
).
Here's an example of a configuration file that dalia
would load from $HOME/.dalia/config
:
[workspace]~/Documents/workspace
~/Desktop
[icloud]~/Library/Mobile\ Documents/com~apple~CloudDocs
/Users/johnappleseed/Music
[photos] /Users/johnappleseed/Pictures
This configuration file will create the following aliases:
workspace='cd ~/Documents/workspace'
desktop='cd ~/Desktop'
icloud='cd '~/Library/Mobile\ Documents/com~apple~CloudDocs'
music='cd /Users/johnappleseed/Music'
photos='cd /Users/johnappleseed/Pictures'
Now, once dalia
loads you can change directories with either workspace
, icloud
, or any other configured alias right from your shell.
First, install Rust. Next, run:
$ cargo install dalia
to install dalia. Finally, add the following line to your shell's configuration file to initialize all aliases:
$ eval "$(/path/to/cmd/dalia aliases)"
This line will generate and output an alias command for each configured path in the current terminal session. It's a good idea to include it in whichever configuration file your shell runs at the start of each session so that the aliases are always available.
Dalia expects to find its configuration, in a file named config
, in the directory $HOME/.dalia
, but
that location can be changed by setting the DALIA_CONFIG_PATH
environment variable to somewhere
else and putting the config
file in there instead.