mise 2026.9.4

Dev tools, env vars, and tasks in one CLI
use eyre::Result;
use tabled::Tabled;

use crate::config::Config;
use crate::ui::table;

/// List shell aliases
///
/// Shows the shell aliases that are set in the current directory.
/// These are defined in `mise.toml` under the `[shell_alias]` section.
#[derive(Debug, usage_rs::Args)]
#[usage(
    visible_alias = "list",
    example(
        r###"mise shell-alias ls
alias    command
ll       ls -la
gs       git status"###
    ),
    verbatim_doc_comment
)]
pub(super) struct ShellAliasLs {
    /// Don't show table header
    #[usage(long)]
    pub no_header: bool,
}

impl ShellAliasLs {
    pub(super) async fn run(self) -> Result<()> {
        let config = Config::get().await?;
        let rows = config
            .shell_aliases
            .iter()
            .map(|(name, (command, _path))| Row {
                alias: name.clone(),
                command: command.clone(),
            })
            .collect::<Vec<_>>();
        let mut table = tabled::Table::new(rows);
        table::print(&mut table, self.no_header)?;
        Ok(())
    }
}

#[derive(Tabled)]
struct Row {
    alias: String,
    command: String,
}