mirror of
https://github.com/SkyfallWasTaken/dinopkg.git
synced 2024-11-22 02:33:39 +00:00
Broken
This commit is contained in:
parent
acfcb28d28
commit
f9d384d350
4 changed files with 31 additions and 3 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1 +1,4 @@
|
|||
/target
|
||||
package.json
|
||||
package-lock.json
|
||||
bun.lockb
|
|
@ -1,10 +1,12 @@
|
|||
use clap::{Parser, Subcommand};
|
||||
|
||||
pub mod run;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(version, about, long_about = None)]
|
||||
pub struct Cli {
|
||||
#[command(subcommand)]
|
||||
command: Commands,
|
||||
pub command: Commands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
|
@ -12,6 +14,20 @@ pub enum Commands {
|
|||
/// Run a script in package.json
|
||||
Run {
|
||||
/// The name of the script to run
|
||||
script_name: bool,
|
||||
script_name: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
pub(crate) trait Command {
|
||||
async fn run(command: &Commands);
|
||||
}
|
||||
|
||||
impl Command for Commands {
|
||||
async fn run(&self) {
|
||||
match self {
|
||||
Commands::Run { .. } => {
|
||||
run::Run::run(self).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
8
src/command/run.rs
Normal file
8
src/command/run.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
use super::{Command, Commands};
|
||||
|
||||
pub struct Run;
|
||||
impl Command for Run {
|
||||
async fn run(command: &Commands) {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
use clap::Parser;
|
||||
|
||||
mod command;
|
||||
use command::Cli;
|
||||
use command::{Cli, Command};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let cli = Cli::parse();
|
||||
cli.command.run().await;
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue