handle_path_command

Function handle_path_command 

Source
pub fn handle_path_command(
    action: Option<PathAction>,
    check: bool,
    var: &str,
    permanent: bool,
) -> Result<()>
Expand description

Handles PATH command operations including add, remove, clean, dedupe, check, list, and move.

§Arguments

  • action - The specific PATH action to perform, or None to list entries
  • check - Whether to check for invalid entries when listing
  • var - The environment variable name (typically “PATH”)
  • permanent - Whether to make changes permanent to the system

§Errors

Returns an error if:

  • The specified environment variable is not found
  • File system operations fail (creating directories, reading/writing)
  • Invalid input is provided for move operations
  • Environment variable operations fail

§Panics

Panics if action is None but the function logic expects it to be Some. This should not happen in normal usage as the logic handles the None case before calling expect().