mirror of
https://github.com/SkyfallWasTaken/dinopkg.git
synced 2024-11-10 05:39: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
|
/target
|
||||||
|
package.json
|
||||||
|
package-lock.json
|
||||||
|
bun.lockb
|
|
@ -1,10 +1,12 @@
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
|
|
||||||
|
pub mod run;
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(version, about, long_about = None)]
|
#[command(version, about, long_about = None)]
|
||||||
pub struct Cli {
|
pub struct Cli {
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: Commands,
|
pub command: Commands,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
|
@ -12,6 +14,20 @@ pub enum Commands {
|
||||||
/// Run a script in package.json
|
/// Run a script in package.json
|
||||||
Run {
|
Run {
|
||||||
/// The name of the script to 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;
|
use clap::Parser;
|
||||||
|
|
||||||
mod command;
|
mod command;
|
||||||
use command::Cli;
|
use command::{Cli, Command};
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
cli.command.run().await;
|
||||||
println!("Hello, world!");
|
println!("Hello, world!");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue