-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tasks): optional automatic outputs
Fixes #2621
- Loading branch information
Showing
12 changed files
with
409 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use std::env; | ||
use crate::config::Config; | ||
use crate::Result; | ||
|
||
/// Print the current PATH entries mise is providing | ||
#[derive(Debug, clap::Args)] | ||
#[clap(verbatim_doc_comment, after_long_help = AFTER_LONG_HELP)] | ||
pub struct Path { | ||
/// Print all entries including those not provided by mise | ||
#[clap(long, short, verbatim_doc_comment)] | ||
full: bool, | ||
} | ||
|
||
impl Path { | ||
pub fn run(self) -> Result<()> { | ||
let config = Config::get(); | ||
let ts = config.get_toolset()?; | ||
let paths = if self.full { | ||
let env = ts.env_with_path(&config)?; | ||
let path = env.get("PATH").cloned().unwrap_or_default(); | ||
env::split_paths(&path).collect() | ||
} else { | ||
ts.list_final_paths()? | ||
}; | ||
for path in paths { | ||
println!("{}", path.display()); | ||
} | ||
Ok(()) | ||
} | ||
} | ||
|
||
static AFTER_LONG_HELP: &str = color_print::cstr!( | ||
r#"<bold><underline>Examples:</underline></bold> | ||
Get the current PATH entries mise is providing | ||
$ mise path | ||
/home/user/.local/share/mise/installs/node/24.0.0/bin | ||
/home/user/.local/share/mise/installs/rust/1.90.0/bin | ||
/home/user/.local/share/mise/installs/python/3.10.0/bin | ||
"#); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.