2 releases

0.1.1 May 12, 2024
0.1.0 May 12, 2024

#760 in Filesystem

Download history 276/week @ 2024-05-11 14/week @ 2024-05-18

290 downloads per month

MIT license

26KB
595 lines

Patty

Crates License

Cross platform system PATH manager.

Introduction

Patty enables you to manage and modify the system PATH variable on Windows, Linux, and macOS.

It's particularly useful for CLI apps that need to be accessible in PATH.

Patty achieves this by modifying the registry in Windows and adjusting RC files in Linux/macOS, such as zshrc or bashrc.

Install

cargo add patty

Usage

use patty::{PathManager, Options, home_dir};

fn main() {
    let mut patty = patty::Patty::new(Options::default());
    let bin_path = home_dir().unwrap().join("bin");
    let new_path = patty.add(bin_path).unwrap();
    println!("PATH = {:?}", new_path);
}

Examples

see examples

Credits

Inspired by github.com/rust-lang/rustup

Dependencies

~0.2–42MB
~620K SLoC