mirror of
https://codeberg.org/insects/cargo-spiel
synced 2025-05-24 02:53:41 +00:00
fix: properly act like a cargo subcommand
This commit is contained in:
parent
91f29ec4e7
commit
417bba825c
3 changed files with 31 additions and 2 deletions
21
src/main.rs
21
src/main.rs
|
@ -5,15 +5,32 @@ use tokio::runtime::Builder;
|
|||
|
||||
mod server;
|
||||
|
||||
pub const CLAP_STYLING: clap::builder::styling::Styles = clap::builder::styling::Styles::styled()
|
||||
.header(clap_cargo::style::HEADER)
|
||||
.usage(clap_cargo::style::USAGE)
|
||||
.literal(clap_cargo::style::LITERAL)
|
||||
.placeholder(clap_cargo::style::PLACEHOLDER)
|
||||
.error(clap_cargo::style::ERROR)
|
||||
.valid(clap_cargo::style::VALID)
|
||||
.invalid(clap_cargo::style::INVALID);
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version)]
|
||||
#[command(name = "cargo")]
|
||||
#[command(bin_name = "cargo")]
|
||||
#[command(styles = CLAP_STYLING)]
|
||||
enum Cli {
|
||||
Spiel(CliArgs),
|
||||
}
|
||||
|
||||
#[derive(clap::Args, Debug)]
|
||||
#[command(version, about, long_about = None)]
|
||||
struct CliArgs {
|
||||
/// Directory of the Cargo project
|
||||
pub project: Option<PathBuf>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = CliArgs::parse();
|
||||
let Cli::Spiel(args) = Cli::parse();
|
||||
let runtime = Builder::new_current_thread()
|
||||
.worker_threads(2)
|
||||
.enable_io()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue