Skip to content

Commit e512c77

Browse files
committed
feat: add run command
1 parent b2dcd51 commit e512c77

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Experimental package manager for node.js written in rust.
2525
- [ ] `outdated`
2626
- [ ] `why`
2727
- [ ] `licenses`
28-
- [ ] `run`
28+
- [x] `run`
2929
- [x] `test`
3030
- [ ] `exec`
3131

crates/cli/src/commands.rs

+9
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ pub enum Subcommands {
2020
Add(AddArgs),
2121
/// Runs a package's "test" script, if one was provided.
2222
Test,
23+
/// Runs a defined package script.
24+
#[clap(name = "run")]
25+
RunScript(RunScriptArgs),
2326
}
2427

2528
#[derive(Parser, Debug)]
@@ -49,3 +52,9 @@ impl AddArgs {
4952
}
5053
}
5154
}
55+
56+
#[derive(Parser, Debug)]
57+
pub struct RunScriptArgs {
58+
/// A pre-defined package script.
59+
pub command: String,
60+
}

crates/cli/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ pub async fn run_commands() -> Result<()> {
3535
Subcommands::Test => {
3636
PackageJson::from_path(&package_json_path)?.execute_command("test")?;
3737
}
38+
Subcommands::RunScript(args) => {
39+
let command = &args.command;
40+
PackageJson::from_path(&package_json_path)?.execute_command(command)?;
41+
}
3842
}
3943

4044
Ok(())

0 commit comments

Comments
 (0)