2023-11-23 06:59:10 +00:00
|
|
|
# pathsd
|
|
|
|
|
2023-12-05 20:13:26 +00:00
|
|
|
*pathsd* is a small CLI utility to manage the `PATH` enironment variable.
|
|
|
|
|
|
|
|
## Building and installing
|
|
|
|
|
|
|
|
*pathsd* is written in Nim programming language. To build it, you need to
|
|
|
|
install the compiler. Consult
|
|
|
|
[nim documentation](https://nim-lang.org/install.html) for instructions on
|
|
|
|
installing nim on your OS. The required version is 2.0.0 or newer.
|
|
|
|
|
|
|
|
To build *pathsd*, issue the following command:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ make
|
|
|
|
```
|
|
|
|
|
|
|
|
The built binary will be placed in `build/pathsd`. To install, copy it
|
|
|
|
somewhere.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
*pathsd* requires at least one directory of _parts_ to operate on, e.g.
|
|
|
|
|
|
|
|
```
|
|
|
|
paths.d/
|
|
|
|
├── 01-bilbo
|
|
|
|
└── 02-homebrew
|
|
|
|
```
|
|
|
|
|
|
|
|
Each of the files should have one or more lines, each line being a single
|
|
|
|
entry in the rendered `PATH` variable.
|
|
|
|
|
|
|
|
Running the program with such a directory would yield the following result:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ pathsd paths.d/
|
2024-01-19 21:46:03 +00:00
|
|
|
export PATH="/Users/bilbo/opt/bin:/opt/homebrew/bin:/opt/homebrew/sbin":<paths inherited from $PATH>
|
2023-12-05 20:13:26 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
You can specify multiple directories. They'll be processed one by one in the
|
|
|
|
order specified on the command line.
|
|
|
|
|
|
|
|
The program is best used in your shell's startup file, e.g.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
eval $(pathsd paths.d/)
|
|
|
|
```
|
|
|
|
|
|
|
|
At the time of writing, only `bash` is supported.
|
|
|
|
|
|
|
|
## Author
|
|
|
|
|
|
|
|
*pathsd* is developed by [Tomek Wójcik](https://www.bthlabs.pl/)
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
*pathsd* is licensed under the MIT License.
|