pathmaster

README

pathmaster

Table of Contents

Introduction

pathmaster is a powerful command-line tool written in Rust for managing your system’s PATH environment variable. It simplifies the process of adding and removing directories from your PATH, ensures backups are created automatically, and provides tools to restore previous configurations.

Managing the PATH variable is crucial for system performance and command execution. pathmaster provides a safe and efficient way to handle PATH modifications, with features designed to prevent errors and maintain system stability.

pathmaster

New in Version 0.2.3

Features

Backup Management

New in Version 0.2.2

Features

Core Features (Updated in 0.2.2)

Path Management

Safety Features

Usage

Backup Mode Configuration

# Only back up PATH when adding a directory
pathmaster --backup-mode path add ~/bin

# Only back up shell config when flushing invalid paths
pathmaster --backup-mode shell flush

# Reset to backing up both
pathmaster --backup-mode default

# Toggle between backup modes
pathmaster --backup-mode switch

Checking PATH Sources

pathmaster check

Now provides enhanced output showing:

Flushing Invalid Paths

pathmaster flush

Improved in v0.2.2 with:

Configuration Files

pathmaster now better handles various configuration files:

Documentation

Please see the man page (man pathmaster) for detailed information about all commands and features.

Technical Details

For v0.2.2, significant improvements were made to:

Upgrading

When upgrading to v0.2.2:

  1. Backup your current configuration
  2. Update using your package manager or cargo
  3. Review any system-wide PATH modifications
  4. Check shell framework compatibility

Known Issues

None in current release.

Coming in Future Releases

Features

Installation

Prerequisites

Building from Source

  1. Clone the Repository

    git clone https://github.com/jwliles/pathmaster.git
    cd pathmaster
    
  2. Build the Project

    cargo build --release
    

    This command compiles the project in release mode, producing an optimized binary.

  3. Install the Binary

    Optionally, you can install the binary system-wide:

    sudo cp target/release/pathmaster /usr/local/bin/
    

    Or add it to your PATH:

    export PATH="$PATH:$(pwd)/target/release"
    

Usage

Command Overview

pathmaster [COMMAND] [OPTIONS]

Commands

add

Add a directory to your PATH.

Usage:

pathmaster add <directory>

Options:

remove

Remove a directory from your PATH.

Usage:

pathmaster remove <directory>

Options:

list

List all current entries in your PATH.

Usage:

pathmaster list

check

Validate current PATH entries and identify invalid or missing directories.

Usage:

pathmaster check

Example Output:

Invalid directories in PATH:
  /home/user/.config/emacs/bin
  /home/user/old/scripts

flush

The flush command provides a safe way to remove invalid directories from your PATH:

Usage:

pathmaster flush
# or
pathmaster -f

Process:

  1. Creates a backup of current PATH
  2. Creates a backup of shell configuration file
  3. Identifies invalid directory entries
  4. Removes invalid entries from PATH
  5. Updates shell configuration for persistence
  6. Provides detailed feedback about changes

Safety Features:

Example Output:

Created backup of shell config at: /home/user/.bashrc.bak
Removing invalid path: /home/user/.config/emacs/bin
Removing invalid path: /home/user/old/scripts
Successfully removed 2 invalid path(s) and updated shell configuration.

history

Show the backup history of your PATH.

Usage:

pathmaster history

restore

Restore your PATH from a previous backup.

Usage:

pathmaster restore [--timestamp <timestamp>]

Options:

Examples

Configuration

pathmaster now supports configurable backup modes to provide more control over what gets backed up during operations. This can be especially useful when:

pathmaster modifies your shell configuration file to make changes to PATH persistent across sessions.

Note: Always review changes made to your shell configuration files. pathmaster adds an export command to update your PATH.

Backup Management

pathmaster provides flexible backup management with configurable backup modes:

Backup Modes

Use the --backup-mode flag to control what gets backed up:

Examples:

# Only back up PATH when adding a directory
pathmaster --backup-mode path add ~/bin

# Only back up shell config when flushing invalid paths
pathmaster --backup-mode shell flush

# Reset to backing up both
pathmaster --backup-mode default

# Toggle between backup modes
pathmaster --backup-mode switch

Backup Storage

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the Repository

  2. Create a Feature Branch

    git checkout -b feature/your-feature
    
  3. Commit Your Changes

    git commit -am 'Add your feature'
    
  4. Push to the Branch

    git push origin feature/your-feature
    
  5. Create a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.