mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-07 14:27:54 +00:00
remove OpaqueStringRemainder and use Remainder like intended
This commit is contained in:
parent
67865263c1
commit
d8748b1efc
10 changed files with 46 additions and 50 deletions
|
|
@ -14,7 +14,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
.help("Shows an abuse log entry"),
|
||||
command!(abuselog, ("flagdeny", ["fd"]), log_param, Optional(("value", Toggle)) => format!("admin_abuselog_flag_deny_{}", log_param.name()))
|
||||
.help("Sets the deny flag on an abuse log entry"),
|
||||
command!(abuselog, ("description", ["desc"]), log_param, Optional(("desc", OpaqueStringRemainder)) => format!("admin_abuselog_description_{}", log_param.name()))
|
||||
command!(abuselog, ("description", ["desc"]), log_param, Optional(Remainder(("desc", OpaqueString))) => format!("admin_abuselog_description_{}", log_param.name()))
|
||||
.flag(CLEAR)
|
||||
.flag(YES)
|
||||
.help("Sets the description of an abuse log entry"),
|
||||
|
|
@ -27,7 +27,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
].into_iter()
|
||||
};
|
||||
let abuselog_cmds = [
|
||||
command!(abuselog, ("create", ["c", "new"]), ("account", UserRef), Optional(("description", OpaqueStringRemainder)) => "admin_abuselog_create")
|
||||
command!(abuselog, ("create", ["c", "new"]), ("account", UserRef), Optional(Remainder(("description", OpaqueString))) => "admin_abuselog_create")
|
||||
.flag(("deny-boy-usage", ["deny"]))
|
||||
.help("Creates an abuse log entry")
|
||||
]
|
||||
|
|
@ -66,7 +66,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
.help("Recovers a system"),
|
||||
command!(admin, ("systemdelete", ["sd"]), SystemRef => "admin_system_delete")
|
||||
.help("Deletes a system"),
|
||||
command!(admin, ("sendmessage", ["sendmsg"]), ("account", UserRef), ("content", OpaqueStringRemainder) => "admin_send_message")
|
||||
command!(admin, ("sendmessage", ["sendmsg"]), ("account", UserRef), Remainder(("content", OpaqueString)) => "admin_send_message")
|
||||
.help("Sends a message to a user"),
|
||||
]
|
||||
.into_iter()
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
|
||||
let group_new = tokens!(group, ("new", ["n"]));
|
||||
let group_new_cmd = [
|
||||
command!(group_new, ("name", OpaqueStringRemainder) => "group_new")
|
||||
command!(group_new, Remainder(("name", OpaqueString)) => "group_new")
|
||||
.help("Creates a new group"),
|
||||
]
|
||||
.into_iter();
|
||||
|
|
@ -37,7 +37,7 @@ 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", OpaqueStringRemainder) => "group_rename")
|
||||
command!(group_name, Remainder(("name", OpaqueString)) => "group_rename")
|
||||
.help("Renames the group"),
|
||||
]
|
||||
.into_iter();
|
||||
|
|
@ -49,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", OpaqueStringRemainder) => "group_change_display_name")
|
||||
command!(group_display_name, Remainder(("name", OpaqueString)) => "group_change_display_name")
|
||||
.help("Changes the group's display name"),
|
||||
]
|
||||
.into_iter();
|
||||
|
|
@ -67,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", OpaqueStringRemainder) => "group_change_description")
|
||||
command!(group_description, Remainder(("description", OpaqueString)) => "group_change_description")
|
||||
.help("Changes the group's description"),
|
||||
]
|
||||
.into_iter();
|
||||
|
|
@ -154,7 +154,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
|
||||
let search = tokens!(
|
||||
("search", ["find", "query"]),
|
||||
("query", OpaqueStringRemainder)
|
||||
Remainder(("query", OpaqueString))
|
||||
);
|
||||
let group_list_members = tokens!(group_target, ("members", ["list", "ls"]));
|
||||
let group_list_members_cmd = [
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use super::*;
|
|||
|
||||
pub fn cmds() -> impl Iterator<Item = Command> {
|
||||
[
|
||||
command!("import", Optional(("url", OpaqueStringRemainder)) => "import").flag(YES),
|
||||
command!("import", Optional(Remainder(("url", OpaqueString))) => "import").flag(YES),
|
||||
command!("export" => "export"),
|
||||
]
|
||||
.into_iter()
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
let member_name = tokens!(member_target, name);
|
||||
[
|
||||
command!(member_name => "member_name_show").help("Shows a member's name"),
|
||||
command!(member_name, ("name", OpaqueStringRemainder) => "member_name_update")
|
||||
command!(member_name, Remainder(("name", OpaqueString)) => "member_name_update")
|
||||
.flag(YES)
|
||||
.help("Changes a member's name"),
|
||||
]
|
||||
|
|
@ -62,7 +62,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
command!(member_desc, CLEAR => "member_desc_clear")
|
||||
.flag(YES)
|
||||
.help("Clears a member's description"),
|
||||
command!(member_desc, ("description", OpaqueStringRemainder) => "member_desc_update")
|
||||
command!(member_desc, Remainder(("description", OpaqueString)) => "member_desc_update")
|
||||
.help("Changes a member's description"),
|
||||
]
|
||||
.into_iter()
|
||||
|
|
@ -87,7 +87,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
[
|
||||
command!(member_pronouns => "member_pronouns_show")
|
||||
.help("Shows a member's pronouns"),
|
||||
command!(member_pronouns, ("pronouns", OpaqueStringRemainder) => "member_pronouns_update")
|
||||
command!(member_pronouns, Remainder(("pronouns", OpaqueString)) => "member_pronouns_update")
|
||||
.help("Changes a member's pronouns"),
|
||||
command!(member_pronouns, CLEAR => "member_pronouns_clear")
|
||||
.flag(YES)
|
||||
|
|
@ -139,7 +139,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
[
|
||||
command!(member_display_name => "member_displayname_show")
|
||||
.help("Shows a member's display name"),
|
||||
command!(member_display_name, ("name", OpaqueStringRemainder) => "member_displayname_update")
|
||||
command!(member_display_name, Remainder(("name", OpaqueString)) => "member_displayname_update")
|
||||
.help("Changes a member's display name"),
|
||||
command!(member_display_name, CLEAR => "member_displayname_clear")
|
||||
.flag(YES)
|
||||
|
|
@ -152,7 +152,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
[
|
||||
command!(member_server_name => "member_servername_show")
|
||||
.help("Shows a member's server name"),
|
||||
command!(member_server_name, ("name", OpaqueStringRemainder) => "member_servername_update")
|
||||
command!(member_server_name, Remainder(("name", OpaqueString)) => "member_servername_update")
|
||||
.help("Changes a member's server name"),
|
||||
command!(member_server_name, CLEAR => "member_servername_clear")
|
||||
.flag(YES)
|
||||
|
|
@ -165,7 +165,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
[
|
||||
command!(member_proxy => "member_proxy_show")
|
||||
.help("Shows a member's proxy tags"),
|
||||
command!(member_proxy, ("tags", OpaqueString) => "member_proxy_set")
|
||||
command!(member_proxy, Remainder(("tags", OpaqueString)) => "member_proxy_set")
|
||||
.help("Sets a member's proxy tags"),
|
||||
command!(member_proxy, ("add", ["a"]), ("tag", OpaqueString) => "member_proxy_add")
|
||||
.help("Adds proxy tag to a member"),
|
||||
|
|
@ -298,7 +298,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
let member_list_group_cmds = [
|
||||
command!(member_group => "member_list_groups"),
|
||||
command!(member_group, "list" => "member_list_groups"),
|
||||
command!(member_group, ("search", ["find", "query"]), ("query", OpaqueStringRemainder) => "member_search_groups"),
|
||||
command!(member_group, ("search", ["find", "query"]), Remainder(("query", OpaqueString)) => "member_search_groups"),
|
||||
]
|
||||
.into_iter()
|
||||
.map(|cmd| cmd.flags(get_list_flags()));
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
let reproxy = ("reproxy", ["rp", "crimes", "crime"]);
|
||||
|
||||
let edit = ("edit", ["e"]);
|
||||
let new_content_param = Remainder(("new_content", OpaqueString));
|
||||
let apply_edit = |cmd: Command| {
|
||||
cmd.flag(("append", ["a"]))
|
||||
.flag(("prepend", ["p"]))
|
||||
|
|
@ -25,9 +26,9 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
.help("Shows information about a proxied message"),
|
||||
command!(message, author => "message_author").help("Shows the author of a proxied message"),
|
||||
command!(message, delete => "message_delete").help("Deletes a proxied message"),
|
||||
apply_edit(command!(message, edit, ("new_content", OpaqueStringRemainder) => "message_edit_specified")),
|
||||
apply_edit(command!(edit, Skip(MessageRef), ("new_content", OpaqueStringRemainder) => "message_edit_specified")),
|
||||
apply_edit(command!(edit, ("new_content", OpaqueStringRemainder) => "message_edit")),
|
||||
apply_edit(command!(message, edit, new_content_param => "message_edit_specified")),
|
||||
apply_edit(command!(edit, Skip(MessageRef), new_content_param => "message_edit_specified")),
|
||||
apply_edit(command!(edit, new_content_param => "message_edit")),
|
||||
command!(reproxy, ("member", MemberRef) => "message_reproxy")
|
||||
.help("Reproxies a message with a different member"),
|
||||
command!(reproxy, ("msg", MessageRef), ("member", MemberRef) => "message_reproxy_specified")
|
||||
|
|
|
|||
|
|
@ -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, OpaqueStringRemainder => "switch_move"), // TODO: datetime parsing
|
||||
command!(switch, r#move, Remainder(OpaqueString) => "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),
|
||||
|
|
|
|||
|
|
@ -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", OpaqueStringRemainder) => "system_new_name")
|
||||
command!(system_new, Remainder(("name", OpaqueString)) => "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", OpaqueStringRemainder) => "system_rename")
|
||||
command!(system_name_self, Remainder(("name", OpaqueString)) => "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", OpaqueStringRemainder) => "system_rename_server_name")
|
||||
command!(system_server_name_self, Remainder(("name", OpaqueString)) => "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", OpaqueStringRemainder) => "system_change_description")
|
||||
command!(system_description_self, Remainder(("description", OpaqueString)) => "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", OpaqueStringRemainder) => "system_change_tag")
|
||||
command!(system_tag_self, Remainder(("tag", OpaqueString)) => "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", OpaqueStringRemainder) => "system_change_server_tag")
|
||||
command!(system_server_tag_self, Remainder(("tag", OpaqueString)) => "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", OpaqueStringRemainder) => "system_change_pronouns")
|
||||
command!(system_pronouns_self, Remainder(("pronouns", OpaqueString)) => "system_change_pronouns")
|
||||
.help("Changes your system's pronouns"),
|
||||
]
|
||||
.into_iter();
|
||||
|
|
@ -274,7 +274,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
|||
let system_list = tokens!("members", list);
|
||||
let search = tokens!(
|
||||
("search", ["query", "find"]),
|
||||
("query", OpaqueStringRemainder),
|
||||
Remainder(("query", OpaqueString))
|
||||
);
|
||||
let add_list_flags = |cmd: Command| cmd.flags(get_list_flags());
|
||||
let system_list_cmd = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue