Skip to content

Commit

Permalink
Fix the argument value parsers the new ID types
Browse files Browse the repository at this point in the history
  • Loading branch information
nickelc committed Jan 10, 2024
1 parent 2e58209 commit 6f89e38
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/bin/modiom/commands/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use prettytable::format;
use textwrap::fill;
use tokio::runtime::Runtime;

use modio::types::id::{GameId, ModId};
use modiom::config::Config;

use crate::command_prelude::*;
Expand All @@ -15,14 +16,14 @@ pub fn cli() -> Command {
.help("Unique id of a game.")
.value_name("GAME")
.required(true)
.value_parser(value_parser!(u32)),
.value_parser(value_parser!(GameId)),
)
.arg(
Arg::new("mod")
.help("Unique id of a mod.")
.value_name("MOD")
.required(true)
.value_parser(value_parser!(u32)),
.value_parser(value_parser!(ModId)),
)
.arg(opt("files", "List all files.").action(ArgAction::SetTrue))
.arg(opt("stats", "Show the statistics.").action(ArgAction::SetTrue))
Expand Down
3 changes: 2 additions & 1 deletion src/bin/modiom/commands/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use tokio::runtime::Runtime;

use modio::filter::custom_filter;
use modio::filter::prelude::*;
use modio::types::id::GameId;
use modiom::config::Config;

use crate::command_prelude::*;
Expand All @@ -17,7 +18,7 @@ pub fn cli() -> Command {
"When specified, modiom will search for mods of the game.",
)
.value_name("ID")
.value_parser(value_parser!(u32)),
.value_parser(value_parser!(GameId)),
)
.arg(
opt("id", "Specify the id of the game or mod.")
Expand Down
8 changes: 4 additions & 4 deletions src/bin/modiom/commands/subs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ pub fn cli() -> Command {
.help("Unique id of a game.")
.value_name("GAME")
.required(true)
.value_parser(value_parser!(u32)),
.value_parser(value_parser!(id::GameId)),
)
.arg(
Arg::new("mod")
.help("Unique id of a mod.")
.value_name("MOD")
.required(true)
.value_parser(value_parser!(u32)),
.value_parser(value_parser!(id::ModId)),
),
)
.subcommand(
Expand All @@ -48,14 +48,14 @@ pub fn cli() -> Command {
.help("Unique id of a game.")
.value_name("GAME")
.required(true)
.value_parser(value_parser!(u32)),
.value_parser(value_parser!(id::GameId)),
)
.arg(
Arg::new("mod")
.help("Unique id of a mod.")
.value_name("MOD")
.required(true)
.value_parser(value_parser!(u32)),
.value_parser(value_parser!(id::ModId)),
),
)
}
Expand Down
5 changes: 3 additions & 2 deletions src/bin/modiom/commands/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use tokio::runtime::Runtime;
use tokio_util::io::ReaderStream;

use modio::files::AddFileOptions;
use modio::types::id::{GameId, ModId};
use modiom::config::Config;
use modiom::md5::Md5;

Expand All @@ -22,14 +23,14 @@ pub fn cli() -> Command {
.help("Unique id of the game.")
.value_name("GAME")
.required(true)
.value_parser(value_parser!(u32)),
.value_parser(value_parser!(GameId)),
)
.arg(
Arg::new("mod")
.help("Unique id of the mod.")
.value_name("MOD")
.required(true)
.value_parser(value_parser!(u32)),
.value_parser(value_parser!(ModId)),
)
.arg(opt("filename", "Overwrite the filename.").value_name("NAME"))
.arg(opt("version", "Version of this file release.").value_name("VERSION"))
Expand Down

0 comments on commit 6f89e38

Please sign in to comment.