diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 310ae21..3832b46 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -50,7 +50,7 @@ jobs: id: get shell: bash run: | - ./target/release/core -a ${{ inputs.addr }} -p ${{ inputs.core }} >> $GITHUB_OUTPUT + ./target/release/cli post ${{ inputs.addr }} ${{ inputs.core }} >> $GITHUB_OUTPUT publish: needs: diff --git a/core/Cargo.toml b/core/Cargo.toml index 5c2784a..d92733b 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,8 +1,15 @@ [package] name = "core" -author = "monius " version = "0.1.0" edition = "2021" [dependencies] -clap = { version= "4.4.0", features=["derive"] } \ No newline at end of file +clap = { version= "4.4.0", features=["derive"] } + +[lib] +name = "kings" +path = "src/lib.rs" + +[[bin]] +name = "cli" +path = "src/cli.rs" diff --git a/core/src/cli.rs b/core/src/cli.rs new file mode 100644 index 0000000..04aade3 --- /dev/null +++ b/core/src/cli.rs @@ -0,0 +1,24 @@ +use clap::{Parser, Subcommand}; + +#[derive(Parser)] +#[command(author, version)] +struct Cli { + #[command(subcommand)] + args: Kings, +} + +#[derive(Subcommand)] +enum Kings { + Post { + addr: String, + promo: String, + }, +} + +fn main() -> std::io::Result<()>{ + let cli = Cli::parse(); + match cli.args { + Kings::Post { addr, promo } => println!("ref={:?}", promo) + } + Ok(()) +} diff --git a/core/src/lib.rs b/core/src/lib.rs new file mode 100644 index 0000000..e69de29 diff --git a/core/src/main.rs b/core/src/main.rs deleted file mode 100644 index 0843e7b..0000000 --- a/core/src/main.rs +++ /dev/null @@ -1,17 +0,0 @@ -use clap::Parser; - -#[derive(Parser)] -#[command(author, version, about, long_about = None)] -struct Cli { - #[arg(short)] - addr: String, - #[arg(short)] - promo: u32, -} - -fn main() { - let cli = Cli::parse(); - let (_addr, _promo) = (cli.addr, cli.promo); - - println!("ref={:?}", _promo); -} \ No newline at end of file