handle_list_command

Function handle_list_command 

Source
pub fn handle_list_command(
    source: Option<&str>,
    query: Option<&str>,
    format: &str,
    sort: &str,
    names_only: bool,
    limit: Option<usize>,
    stats: bool,
) -> Result<()>
Expand description

Handles the list command to display environment variables with various formatting options.

§Arguments

  • source - Optional filter by source (system, user, process, shell)
  • query - Optional search query to filter variables
  • format - Output format (table, json, simple, compact)
  • sort - Sort order (name, value, source)
  • names_only - Whether to display only variable names
  • limit - Optional limit on number of variables to display
  • stats - Whether to display statistics

§Errors

Returns an error if:

  • Environment variables cannot be loaded
  • Invalid source type is provided
  • JSON serialization fails