fix some parameters that should parse remainder but werent

This commit is contained in:
dusk 2025-10-15 19:10:44 +00:00
parent a307dd37c4
commit 2fe747d704
No known key found for this signature in database
4 changed files with 28 additions and 21 deletions

View file

@ -17,9 +17,11 @@ pub fn cmds() -> impl Iterator<Item = Command> {
let group_target = targeted();
let group_new = tokens!(group, ("new", ["n"]));
let group_new_cmd =
[command!(group_new, ("name", OpaqueString) => "group_new").help("Creates a new group")]
.into_iter();
let group_new_cmd = [
command!(group_new, ("name", OpaqueStringRemainder) => "group_new")
.help("Creates a new group"),
]
.into_iter();
let group_info_cmd = [command!(group_target => "group_info")
.flag(ALL)
@ -35,7 +37,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
command!(group_name, CLEAR => "group_clear_name")
.flag(YES)
.help("Clears the group's name"),
command!(group_name, ("name", OpaqueString) => "group_rename").help("Renames the group"),
command!(group_name, ("name", OpaqueStringRemainder) => "group_rename")
.help("Renames the group"),
]
.into_iter();
@ -46,7 +49,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
command!(group_display_name, CLEAR => "group_clear_display_name")
.flag(YES)
.help("Clears the group's display name"),
command!(group_display_name, ("name", OpaqueString) => "group_change_display_name")
command!(group_display_name, ("name", OpaqueStringRemainder) => "group_change_display_name")
.help("Changes the group's display name"),
]
.into_iter();
@ -64,7 +67,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
command!(group_description, CLEAR => "group_clear_description")
.flag(YES)
.help("Clears the group's description"),
command!(group_description, ("description", OpaqueString) => "group_change_description")
command!(group_description, ("description", OpaqueStringRemainder) => "group_change_description")
.help("Changes the group's description"),
]
.into_iter();
@ -149,11 +152,15 @@ pub fn cmds() -> impl Iterator<Item = Command> {
let apply_list_opts = |cmd: Command| cmd.flags(get_list_flags());
let search = tokens!(
("search", ["find", "query"]),
("query", OpaqueStringRemainder)
);
let group_list_members = tokens!(group_target, ("members", ["list", "ls"]));
let group_list_members_cmd = [
command!(group_list_members => "group_list_members"),
command!(group_list_members, "list" => "group_list_members"),
command!(group_list_members, ("search", ["find", "query"]), ("query", OpaqueStringRemainder) => "group_search_members"),
command!(group_list_members, search => "group_search_members"),
]
.into_iter()
.map(apply_list_opts);
@ -168,7 +175,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
let system_groups_cmd = [
command!(group, ("list", ["ls"]) => "group_list_groups"),
command!(group, ("search", ["find", "query"]), ("query", OpaqueStringRemainder) => "group_search_groups"),
command!(group, search => "group_search_groups"),
]
.into_iter()
.map(apply_list_opts);

View file

@ -20,7 +20,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
command!(switch, ("commands", ["help"]) => "switch_commands"),
command!(switch, out => "switch_out"),
command!(switch, delete => "switch_delete").flag(("all", ["clear", "c"])),
command!(switch, r#move, OpaqueString => "switch_move"), // TODO: datetime parsing
command!(switch, r#move, OpaqueStringRemainder => "switch_move"), // TODO: datetime parsing
command!(switch, edit, out => "switch_edit_out").flag(YES),
command!(switch, edit, Optional(MemberRefs) => "switch_edit").flags(edit_flags),
command!(switch, copy, Optional(MemberRefs) => "switch_copy").flags(edit_flags),

View file

@ -23,7 +23,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_new = tokens!(system, ("new", ["n"]));
let system_new_cmd = [
command!(system_new => "system_new").help("Creates a new system"),
command!(system_new, ("name", OpaqueString) => "system_new_name")
command!(system_new, ("name", OpaqueStringRemainder) => "system_new_name")
.help("Creates a new system (using the provided name)"),
]
.into_iter();
@ -62,7 +62,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
command!(system_name_self, CLEAR => "system_clear_name")
.flag(YES)
.help("Clears your system's name"),
command!(system_name_self, ("name", OpaqueString) => "system_rename")
command!(system_name_self, ("name", OpaqueStringRemainder) => "system_rename")
.help("Renames your system"),
]
.into_iter();
@ -80,7 +80,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
command!(system_server_name_self, CLEAR => "system_clear_server_name")
.flag(YES)
.help("Clears your system's server name"),
command!(system_server_name_self, ("name", OpaqueString) => "system_rename_server_name")
command!(system_server_name_self, ("name", OpaqueStringRemainder) => "system_rename_server_name")
.help("Renames your system's server name"),
]
.into_iter();
@ -97,7 +97,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
command!(system_description_self, CLEAR => "system_clear_description")
.flag(YES)
.help("Clears your system's description"),
command!(system_description_self, ("description", OpaqueString) => "system_change_description")
command!(system_description_self, ("description", OpaqueStringRemainder) => "system_change_description")
.help("Changes your system's description"),
]
.into_iter();
@ -128,7 +128,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
command!(system_tag_self, CLEAR => "system_clear_tag")
.flag(YES)
.help("Clears your system's tag"),
command!(system_tag_self, ("tag", OpaqueString) => "system_change_tag")
command!(system_tag_self, ("tag", OpaqueStringRemainder) => "system_change_tag")
.help("Changes your system's tag"),
]
.into_iter();
@ -146,7 +146,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
command!(system_server_tag_self, CLEAR => "system_clear_server_tag")
.flag(YES)
.help("Clears your system's server tag"),
command!(system_server_tag_self, ("tag", OpaqueString) => "system_change_server_tag")
command!(system_server_tag_self, ("tag", OpaqueStringRemainder) => "system_change_server_tag")
.help("Changes your system's server tag"),
]
.into_iter();
@ -163,7 +163,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
command!(system_pronouns_self, CLEAR => "system_clear_pronouns")
.flag(YES)
.help("Clears your system's pronouns"),
command!(system_pronouns_self, ("pronouns", OpaqueString) => "system_change_pronouns")
command!(system_pronouns_self, ("pronouns", OpaqueStringRemainder) => "system_change_pronouns")
.help("Changes your system's pronouns"),
]
.into_iter();
@ -267,21 +267,21 @@ pub fn edit() -> impl Iterator<Item = Command> {
.into_iter();
let system_list = ("members", ["list", "l", "find", "f"]);
let system_search = tokens!(
let search = tokens!(
("search", ["query", "find"]),
("query", OpaqueStringRemainder),
);
let add_list_flags = |cmd: Command| cmd.flags(get_list_flags());
let system_list_cmd = [
command!(system_target, system_list => "system_members_list"),
command!(system_target, system_search => "system_members_search"),
command!(system_target, search => "system_members_search"),
]
.into_iter()
.map(add_list_flags);
let system_list_self_cmd = [
command!(system_list => "system_members_list_self"),
command!(system, system_list => "system_members_list_self"),
command!(system, system_search => "system_members_search_self"),
command!(system, search => "system_members_search_self"),
]
.into_iter()
.map(add_list_flags);
@ -290,7 +290,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_groups_cmd = [
command!(system_groups => "system_list_groups"),
command!(system_groups, ("list", ["ls"]) => "system_list_groups"),
command!(system_groups, ("search", ["find", "query"]), ("query", OpaqueStringRemainder) => "system_search_groups"),
command!(system_groups, search => "system_search_groups"),
]
.into_iter()
.map(add_list_flags);

View file

@ -578,6 +578,6 @@ impl ParseMessageLink for regex::Captures<'_> {
fn parse_id(&self, name: &str) -> Result<u64, SmolStr> {
self.name(name)
.and_then(|m| m.as_str().parse::<u64>().ok())
.ok_or_else(|| SmolStr::new(format!("invalid {} in message link", name)))
.ok_or_else(|| SmolStr::new(format!("invalid {} ID in message link", name)))
}
}