Skip to content

nhedger/pathman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pathman

Pathman is a cross-platform Rust library for prepending and appending directories to the user's PATH environment variable.

  • 🚀 Cross-platform. Works on Windows, macOS, and Linux
  • 1️⃣ Idempotent. Does not duplicate entries in the PATH
  • 💬 Comments. Supports adding custom comments in shell config files

Installation

Run the following command to add Pathman to your project's dependencies.

cargo add pathman

Usage

Prepending a directory to the PATH

Use the prepend_to_path function to add a directory to the beginning of the PATH environment variable, which will ensure that the specified directory will be searched first when executing commands. An optional comment can be specified, and it will be added to the shell configuration file on macOS and Linux.

use pathman::prepend_to_path;

prepend_to_path("/Users/nicolas/.biome/bin", Some("Biome installation directory"));

Appending a directory to the PATH

Use the append_to_path function to add a directory to the end of the PATH environment variable. This is useful for adding directories that contain executables that you want to be available system-wide, but not necessarily searched first. An optional comment can also be specified, which will be added to the shell configuration file on macOS and Linux.

use pathman::append_to_path;

append_to_path("/Users/nicolas/.biome/bin", Some("Biome installation directory"));

License

Pathman is licensed under either of:

at your option.

Contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Cross-platform Rust library for prepending and appending directories to the PATH

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages