mirror of
https://github.com/SkyfallWasTaken/dinopkg.git
synced 2024-11-25 03:33:40 +00:00
Clean up prompt and script list
This commit is contained in:
parent
b80ab66892
commit
a3f9a00af5
1 changed files with 8 additions and 5 deletions
|
@ -8,14 +8,14 @@ pub async fn run(script_name: Option<String>) -> Result<()> {
|
|||
let (package_json, package_json_path) = PackageJson::from_file(10).await?;
|
||||
let root_path = package_json_path.parent().unwrap(); // Should never happen, `package.json` should always be there
|
||||
|
||||
match script_name {
|
||||
Some(script_name) => {
|
||||
let Some(scripts) = package_json.scripts else {
|
||||
return Err(eyre!("no `scripts` provided in package.json"));
|
||||
};
|
||||
match script_name {
|
||||
Some(script_name) => {
|
||||
match scripts.get(&script_name) {
|
||||
Some(script) => {
|
||||
println!("> {}", script.bold());
|
||||
println!("{} {}", "$".purple().dimmed(), script.bold().dimmed());
|
||||
|
||||
let status =
|
||||
run_script(DEFAULT_SHELL, DEFAULT_SHELL_EXEC_ARG, &script, root_path)
|
||||
|
@ -40,7 +40,10 @@ pub async fn run(script_name: Option<String>) -> Result<()> {
|
|||
}
|
||||
}
|
||||
_ => {
|
||||
todo!()
|
||||
println!("{}", "Available scripts:".bold().underline());
|
||||
for (key, val) in scripts.iter() {
|
||||
println!("{} - {}", key.bold(), val.dimmed())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue