-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from trash-pandy/feature/clap-derive
Switch all clap usage to derive style
- Loading branch information
Showing
27 changed files
with
346 additions
and
347 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
use anyhow::Result; | ||
use clap::{ArgMatches, Command}; | ||
|
||
mod modrinth; | ||
|
||
pub fn cli() -> Command { | ||
Command::new("add") | ||
.about("Add a plugin/mod/datapack") | ||
.subcommand(modrinth::cli()) | ||
#[derive(clap::Subcommand)] | ||
pub enum Commands { | ||
/// Add from modrinth | ||
#[command(alias = "mr")] | ||
Modrinth(modrinth::Args), | ||
} | ||
|
||
pub async fn run(matches: &ArgMatches) -> Result<()> { | ||
match matches.subcommand() { | ||
Some(("modrinth" | "mr", sub_matches)) => modrinth::run(sub_matches).await?, | ||
_ => unreachable!(), | ||
pub async fn run(args: Commands) -> Result<()> { | ||
match args { | ||
Commands::Modrinth(args) => modrinth::run(args).await?, | ||
} | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,19 @@ | ||
use anyhow::Result; | ||
use clap::{ArgMatches, Command}; | ||
|
||
mod docker; | ||
mod gitignore; | ||
|
||
pub fn cli() -> Command { | ||
Command::new("env") | ||
.about("Helpers for setting up the environment") | ||
.subcommand_required(true) | ||
.arg_required_else_help(true) | ||
.subcommand(gitignore::cli()) | ||
.subcommand(docker::cli()) | ||
#[derive(clap::Subcommand)] | ||
pub enum Commands { | ||
/// Modify the gitignore | ||
Gitignore, | ||
/// Write the default Dockerfile and .dockerignore | ||
Docker, | ||
} | ||
|
||
pub fn run(matches: &ArgMatches) -> Result<()> { | ||
match matches.subcommand() { | ||
Some(("gitignore", sub_matches)) => gitignore::run(sub_matches)?, | ||
Some(("docker", sub_matches)) => docker::run(sub_matches)?, | ||
_ => unreachable!(), | ||
pub fn run(commands: Commands) -> Result<()> { | ||
Check warning on line 14 in src/commands/env/mod.rs GitHub Actions / clippythis argument is passed by value, but not consumed in the function body
|
||
match commands { | ||
Commands::Gitignore => gitignore::run(), | ||
Commands::Docker => docker::run(), | ||
} | ||
Ok(()) | ||
} |
Oops, something went wrong.