make some common flags into constants

This commit is contained in:
dusk 2025-10-08 04:29:48 +00:00
parent 479e0a59b5
commit f4216a83a9
No known key found for this signature in database
10 changed files with 95 additions and 89 deletions

View file

@ -15,8 +15,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
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()))
.flag(("clear", ["c"]))
.flag(("yes", ["y"]))
.flag(CLEAR)
.flag(YES)
.help("Sets the description of an abuse log entry"),
command!(abuselog, ("adduser", ["au"]), log_param => format!("admin_abuselog_add_user_{}", log_param.name()))
.help("Adds a user to an abuse log entry"),
@ -37,31 +37,31 @@ pub fn cmds() -> impl Iterator<Item = Command> {
[
command!(admin, ("updatesystemid", ["usid"]), SystemRef, ("new_hid", OpaqueString) => "admin_update_system_id")
.flag(("yes", ["y"]))
.flag(YES)
.help("Updates a system's ID"),
command!(admin, ("updatememberid", ["umid"]), MemberRef, ("new_hid", OpaqueString) => "admin_update_member_id")
.flag(("yes", ["y"]))
.flag(YES)
.help("Updates a member's ID"),
command!(admin, ("updategroupid", ["ugid"]), GroupRef, ("new_hid", OpaqueString) => "admin_update_group_id")
.flag(("yes", ["y"]))
.flag(YES)
.help("Updates a group's ID"),
command!(admin, ("rerollsystemid", ["rsid"]), SystemRef => "admin_reroll_system_id")
.flag(("yes", ["y"]))
.flag(YES)
.help("Rerolls a system's ID"),
command!(admin, ("rerollmemberid", ["rmid"]), MemberRef => "admin_reroll_member_id")
.flag(("yes", ["y"]))
.flag(YES)
.help("Rerolls a member's ID"),
command!(admin, ("rerollgroupid", ["rgid"]), GroupRef => "admin_reroll_group_id")
.flag(("yes", ["y"]))
.flag(YES)
.help("Rerolls a group's ID"),
command!(admin, ("updatememberlimit", ["uml"]), SystemRef, Optional(("limit", OpaqueInt)) => "admin_system_member_limit")
.flag(("yes", ["y"]))
.flag(YES)
.help("Updates a system's member limit"),
command!(admin, ("updategrouplimit", ["ugl"]), SystemRef, Optional(("limit", OpaqueInt)) => "admin_system_group_limit")
.flag(("yes", ["y"]))
.flag(YES)
.help("Updates a system's group limit"),
command!(admin, ("systemrecover", ["sr"]), ("token", OpaqueString), ("account", UserRef) => "admin_system_recover")
.flag(("yes", ["y"]))
.flag(YES)
.flag(("reroll-token", ["rt"]))
.help("Recovers a system"),
command!(admin, ("systemdelete", ["sd"]), SystemRef => "admin_system_delete")

View file

@ -22,7 +22,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
.into_iter();
let group_info_cmd = [command!(group_target => "group_info")
.flag(("all", ["a"]))
.flag(ALL)
.help("Shows information about a group")]
.into_iter();
@ -32,8 +32,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
);
let group_name_cmd = [
command!(group_name => "group_show_name").help("Shows the group's name"),
command!(group_name, ("clear", ["c"]) => "group_clear_name")
.flag(("yes", ["y"]))
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"),
]
@ -43,8 +43,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
let group_display_name_cmd = [
command!(group_display_name => "group_show_display_name")
.help("Shows the group's display name"),
command!(group_display_name, ("clear", ["c"]) => "group_clear_display_name")
.flag(("yes", ["y"]))
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")
.help("Changes the group's display name"),
@ -61,8 +61,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
let group_description_cmd = [
command!(group_description => "group_show_description")
.help("Shows the group's description"),
command!(group_description, ("clear", ["c"]) => "group_clear_description")
.flag(("yes", ["y"]))
command!(group_description, CLEAR => "group_clear_description")
.flag(YES)
.help("Clears the group's description"),
command!(group_description, ("description", OpaqueString) => "group_change_description")
.help("Changes the group's description"),
@ -75,8 +75,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
);
let group_icon_cmd = [
command!(group_icon => "group_show_icon").help("Shows the group's icon"),
command!(group_icon, ("clear", ["c"]) => "group_clear_icon")
.flag(("yes", ["y"]))
command!(group_icon, CLEAR => "group_clear_icon")
.flag(YES)
.help("Clears the group's icon"),
command!(group_icon, ("icon", Avatar) => "group_change_icon")
.help("Changes the group's icon"),
@ -86,8 +86,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
let group_banner = tokens!(group_target, ("banner", ["splash", "cover"]));
let group_banner_cmd = [
command!(group_banner => "group_show_banner").help("Shows the group's banner"),
command!(group_banner, ("clear", ["c"]) => "group_clear_banner")
.flag(("yes", ["y"]))
command!(group_banner, CLEAR => "group_clear_banner")
.flag(YES)
.help("Clears the group's banner"),
command!(group_banner, ("banner", Avatar) => "group_change_banner")
.help("Changes the group's banner"),
@ -97,8 +97,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
let group_color = tokens!(group_target, ("color", ["colour"]));
let group_color_cmd = [
command!(group_color => "group_show_color").help("Shows the group's color"),
command!(group_color, ("clear", ["c"]) => "group_clear_color")
.flag(("yes", ["y"]))
command!(group_color, CLEAR => "group_clear_color")
.flag(YES)
.help("Clears the group's color"),
command!(group_color, ("color", OpaqueString) => "group_change_color")
.help("Changes the group's color"),
@ -109,7 +109,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
let group_privacy_cmd = [
command!(group_privacy => "group_show_privacy")
.help("Shows the group's privacy settings"),
command!(group_privacy, ("all", ["a"]), ("level", PrivacyLevel) => "group_change_privacy_all")
command!(group_privacy, ALL, ("level", PrivacyLevel) => "group_change_privacy_all")
.help("Changes all privacy settings for the group"),
command!(group_privacy, ("privacy", GroupPrivacyTarget), ("level", PrivacyLevel) => "group_change_privacy")
.help("Changes a specific privacy setting for the group"),
@ -130,7 +130,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
let group_delete_cmd = [
command!(group_target, ("delete", ["destroy", "erase", "yeet"]) => "group_delete")
.flag(("yes", ["y"]))
.flag(YES)
.help("Deletes the group"),
]
.into_iter();
@ -160,9 +160,9 @@ pub fn cmds() -> impl Iterator<Item = Command> {
let group_modify_members_cmd = [
command!(group_target, "add", Optional(MemberRefs) => "group_add_member")
.flag(("all", ["a"])).flag(("yes", ["y"])),
.flag(ALL).flag(YES),
command!(group_target, ("remove", ["delete", "del", "rem"]), Optional(MemberRefs) => "group_remove_member")
.flag(("all", ["a"])).flag(("yes", ["y"])),
.flag(ALL).flag(YES),
]
.into_iter();

View file

@ -3,7 +3,7 @@ use super::*;
pub fn cmds() -> impl Iterator<Item = Command> {
[
command!("import", Optional(("url", OpaqueStringRemainder)) => "import")
.flag(("yes", ["y"])),
.flag(YES),
command!("export" => "export"),
]
.into_iter()

View file

@ -50,3 +50,7 @@ pub fn all() -> impl Iterator<Item = Command> {
}
pub const RESET: (&str, [&str; 2]) = ("reset", ["clear", "default"]);
pub const CLEAR: (&str, [&str; 1]) = ("clear", ["c"]);
pub const YES: (&str, [&str; 1]) = ("yes", ["y"]);
pub const ALL: (&str, [&str; 1]) = ("all", ["a"]);

View file

@ -49,7 +49,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
[
command!(member_name => "member_name_show").help("Shows a member's name"),
command!(member_name, ("name", OpaqueStringRemainder) => "member_name_update")
.flag(("yes", ["y"]))
.flag(YES)
.help("Changes a member's name"),
]
.into_iter()
@ -59,8 +59,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
let member_desc = tokens!(member_target, description);
[
command!(member_desc => "member_desc_show").help("Shows a member's description"),
command!(member_desc, ("clear", ["c"]) => "member_desc_clear")
.flag(("yes", ["y"]))
command!(member_desc, CLEAR => "member_desc_clear")
.flag(YES)
.help("Clears a member's description"),
command!(member_desc, ("description", OpaqueStringRemainder) => "member_desc_update")
.help("Changes a member's description"),
@ -89,8 +89,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
.help("Shows a member's pronouns"),
command!(member_pronouns, ("pronouns", OpaqueStringRemainder) => "member_pronouns_update")
.help("Changes a member's pronouns"),
command!(member_pronouns, ("clear", ["c"]) => "member_pronouns_clear")
.flag(("yes", ["y"]))
command!(member_pronouns, CLEAR => "member_pronouns_clear")
.flag(YES)
.help("Clears a member's pronouns"),
].into_iter()
};
@ -101,8 +101,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
command!(member_banner => "member_banner_show").help("Shows a member's banner image"),
command!(member_banner, ("banner", Avatar) => "member_banner_update")
.help("Changes a member's banner image"),
command!(member_banner, ("clear", ["c"]) => "member_banner_clear")
.flag(("yes", ["y"]))
command!(member_banner, CLEAR => "member_banner_clear")
.flag(YES)
.help("Clears a member's banner image"),
]
.into_iter()
@ -114,8 +114,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
command!(member_color => "member_color_show").help("Shows a member's color"),
command!(member_color, ("color", OpaqueString) => "member_color_update")
.help("Changes a member's color"),
command!(member_color, ("clear", ["c"]) => "member_color_clear")
.flag(("yes", ["y"]))
command!(member_color, CLEAR => "member_color_clear")
.flag(YES)
.help("Clears a member's color"),
]
.into_iter()
@ -127,8 +127,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
command!(member_birthday => "member_birthday_show").help("Shows a member's birthday"),
command!(member_birthday, ("birthday", OpaqueString) => "member_birthday_update")
.help("Changes a member's birthday"),
command!(member_birthday, ("clear", ["c"]) => "member_birthday_clear")
.flag(("yes", ["y"]))
command!(member_birthday, CLEAR => "member_birthday_clear")
.flag(YES)
.help("Clears a member's birthday"),
]
.into_iter()
@ -141,8 +141,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
.help("Shows a member's display name"),
command!(member_display_name, ("name", OpaqueStringRemainder) => "member_displayname_update")
.help("Changes a member's display name"),
command!(member_display_name, ("clear", ["c"]) => "member_displayname_clear")
.flag(("yes", ["y"]))
command!(member_display_name, CLEAR => "member_displayname_clear")
.flag(YES)
.help("Clears a member's display name"),
].into_iter()
};
@ -154,8 +154,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
.help("Shows a member's server name"),
command!(member_server_name, ("name", OpaqueStringRemainder) => "member_servername_update")
.help("Changes a member's server name"),
command!(member_server_name, ("clear", ["c"]) => "member_servername_clear")
.flag(("yes", ["y"]))
command!(member_server_name, CLEAR => "member_servername_clear")
.flag(YES)
.help("Clears a member's server name"),
].into_iter()
};
@ -171,8 +171,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
.help("Adds proxy tag to a member"),
command!(member_proxy, ("remove", ["r", "rm"]), ("tag", OpaqueString) => "member_proxy_remove")
.help("Removes proxy tag from a member"),
command!(member_proxy, ("clear", ["c"]) => "member_proxy_clear")
.flag(("yes", ["y"]))
command!(member_proxy, CLEAR => "member_proxy_clear")
.flag(YES)
.help("Clears all proxy tags from a member"),
].into_iter()
};
@ -189,8 +189,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
.help("Shows a member's server-specific keep-proxy setting"),
command!(member_server_keep_proxy, Skip(("value", Toggle)) => "member_server_keepproxy_update")
.help("Changes a member's server-specific keep-proxy setting"),
command!(member_server_keep_proxy, ("clear", ["c"]) => "member_server_keepproxy_clear")
.flag(("yes", ["y"]))
command!(member_server_keep_proxy, CLEAR => "member_server_keepproxy_clear")
.flag(YES)
.help("Clears a member's server-specific keep-proxy setting"),
].into_iter()
};
@ -223,8 +223,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
command!(member_avatar => "member_avatar_show").help("Shows a member's avatar"),
command!(member_avatar, ("avatar", Avatar) => "member_avatar_update")
.help("Changes a member's avatar"),
command!(member_avatar, ("clear", ["c"]) => "member_avatar_clear")
.flag(("yes", ["y"]))
command!(member_avatar, CLEAR => "member_avatar_clear")
.flag(YES)
.help("Clears a member's avatar"),
]
.into_iter()
@ -250,8 +250,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
.help("Shows a member's proxy avatar"),
command!(member_webhook_avatar, ("avatar", Avatar) => "member_webhook_avatar_update")
.help("Changes a member's proxy avatar"),
command!(member_webhook_avatar, ("clear", ["c"]) => "member_webhook_avatar_clear")
.flag(("yes", ["y"]))
command!(member_webhook_avatar, CLEAR => "member_webhook_avatar_clear")
.flag(YES)
.help("Clears a member's proxy avatar"),
]
.into_iter()
@ -283,8 +283,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
.help("Shows a member's server-specific avatar"),
command!(member_server_avatar, ("avatar", Avatar) => "member_server_avatar_update")
.help("Changes a member's server-specific avatar"),
command!(member_server_avatar, ("clear", ["c"]) => "member_server_avatar_clear")
.flag(("yes", ["y"]))
command!(member_server_avatar, CLEAR => "member_server_avatar_clear")
.flag(YES)
.help("Clears a member's server-specific avatar"),
]
.into_iter()

View file

@ -12,5 +12,5 @@ pub fn cmds() -> impl Iterator<Item = Command> {
command!(group::targeted(), random => "group_random_member").flags(get_list_flags()),
]
.into_iter()
.map(|cmd| cmd.flag(("all", ["a"])))
.map(|cmd| cmd.flag(ALL))
}

View file

@ -50,8 +50,8 @@ pub fn cmds() -> impl Iterator<Item = Command> {
.help("Shows the current log channel"),
command!(log_channel, ("channel", ChannelRef) => "server_config_log_channel_set")
.help("Sets the log channel"),
command!(log_channel, ("clear", ["c"]) => "server_config_log_channel_clear")
.flag(("yes", ["y"]))
command!(log_channel, CLEAR => "server_config_log_channel_clear")
.flag(YES)
.help("Clears the log channel"),
]
.into_iter();
@ -74,10 +74,10 @@ pub fn cmds() -> impl Iterator<Item = Command> {
command!(log_blacklist => "server_config_log_blacklist_show")
.help("Shows channels where logging is disabled"),
command!(log_blacklist, add, Optional(("channel", ChannelRef)) => "server_config_log_blacklist_add")
.flag(("all", ["a"]))
.flag(ALL)
.help("Adds a channel (or all channels with --all) to the log blacklist"),
command!(log_blacklist, remove, Optional(("channel", ChannelRef)) => "server_config_log_blacklist_remove")
.flag(("all", ["a"]))
.flag(ALL)
.help("Removes a channel (or all channels with --all) from the log blacklist"),
]
.into_iter();
@ -87,10 +87,10 @@ pub fn cmds() -> impl Iterator<Item = Command> {
command!(proxy_blacklist => "server_config_proxy_blacklist_show")
.help("Shows channels where proxying is disabled"),
command!(proxy_blacklist, add, Optional(("channel", ChannelRef)) => "server_config_proxy_blacklist_add")
.flag(("all", ["a"]))
.flag(ALL)
.help("Adds a channel (or all channels with --all) to the proxy blacklist"),
command!(proxy_blacklist, remove, Optional(("channel", ChannelRef)) => "server_config_proxy_blacklist_remove")
.flag(("all", ["a"]))
.flag(ALL)
.help("Removes a channel (or all channels with --all) from the proxy blacklist"),
]
.into_iter();

View file

@ -20,7 +20,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
command!(switch, out => "switch_out"),
command!(switch, r#move, OpaqueString => "switch_move"), // TODO: datetime parsing
command!(switch, delete => "switch_delete").flag(("all", ["clear", "c"])),
command!(switch, edit, out => "switch_edit_out").flag(("yes", ["y"])),
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),
command!(switch, ("commands", ["help"]) => "switch_commands"),

View file

@ -31,8 +31,8 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_webhook = tokens!(system, ("webhook", ["hook"]));
let system_webhook_cmd = [
command!(system_webhook => "system_webhook_show").help("Shows your system's webhook URL"),
command!(system_webhook, ("clear", ["c"]) => "system_webhook_clear")
.flag(("yes", ["y"]))
command!(system_webhook, CLEAR => "system_webhook_clear")
.flag(YES)
.help("Clears your system's webhook URL"),
command!(system_webhook, ("url", OpaqueString) => "system_webhook_set")
.help("Sets your system's webhook URL"),
@ -42,7 +42,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
let add_info_flags = |cmd: Command| {
cmd.flag(("public", ["pub"]))
.flag(("private", ["priv"]))
.flag(("all", ["a"]))
.flag(ALL)
};
let system_info_cmd_self = std::iter::once(add_info_flags(
command!(system => "system_info_self").help("Shows information about your system"),
@ -59,8 +59,8 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_name_self = tokens!(system, "name");
let system_name_self_cmd = [
command!(system_name_self => "system_show_name_self").help("Shows your system's name"),
command!(system_name_self, ("clear", ["c"]) => "system_clear_name")
.flag(("yes", ["y"]))
command!(system_name_self, CLEAR => "system_clear_name")
.flag(YES)
.help("Clears your system's name"),
command!(system_name_self, ("name", OpaqueString) => "system_rename")
.help("Renames your system"),
@ -77,8 +77,8 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_server_name_self_cmd = [
command!(system_server_name_self => "system_show_server_name_self")
.help("Shows your system's server name"),
command!(system_server_name_self, ("clear", ["c"]) => "system_clear_server_name")
.flag(("yes", ["y"]))
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")
.help("Renames your system's server name"),
@ -94,8 +94,8 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_description_self = tokens!(system, ("description", ["desc", "d"]));
let system_description_self_cmd = [
command!(system_description_self => "system_show_description_self").help("Shows your system's description"),
command!(system_description_self, ("clear", ["c"]) => "system_clear_description")
.flag(("yes", ["y"]))
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")
.help("Changes your system's description"),
@ -110,8 +110,8 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_color_self = tokens!(system, ("color", ["colour"]));
let system_color_self_cmd = [
command!(system_color_self => "system_show_color_self").help("Shows your system's color"),
command!(system_color_self, ("clear", ["c"]) => "system_clear_color")
.flag(("yes", ["y"]))
command!(system_color_self, CLEAR => "system_clear_color")
.flag(YES)
.help("Clears your system's color"),
command!(system_color_self, ("color", OpaqueString) => "system_change_color")
.help("Changes your system's color"),
@ -125,8 +125,8 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_tag_self = tokens!(system, ("tag", ["suffix"]));
let system_tag_self_cmd = [
command!(system_tag_self => "system_show_tag_self").help("Shows your system's tag"),
command!(system_tag_self, ("clear", ["c"]) => "system_clear_tag")
.flag(("yes", ["y"]))
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")
.help("Changes your system's tag"),
@ -143,8 +143,8 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_server_tag_self_cmd = [
command!(system_server_tag_self => "system_show_server_tag_self")
.help("Shows your system's server tag"),
command!(system_server_tag_self, ("clear", ["c"]) => "system_clear_server_tag")
.flag(("yes", ["y"]))
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")
.help("Changes your system's server tag"),
@ -160,8 +160,8 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_pronouns_self_cmd = [
command!(system_pronouns_self => "system_show_pronouns_self")
.help("Shows your system's pronouns"),
command!(system_pronouns_self, ("clear", ["c"]) => "system_clear_pronouns")
.flag(("yes", ["y"]))
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")
.help("Changes your system's pronouns"),
@ -177,8 +177,8 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_avatar_self_cmd = [
command!(system_avatar_self => "system_show_avatar_self")
.help("Shows your system's avatar"),
command!(system_avatar_self, ("clear", ["c"]) => "system_clear_avatar")
.flag(("yes", ["y"]))
command!(system_avatar_self, CLEAR => "system_clear_avatar")
.flag(YES)
.help("Clears your system's avatar"),
command!(system_avatar_self, ("avatar", Avatar) => "system_change_avatar")
.help("Changes your system's avatar"),
@ -195,8 +195,8 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_server_avatar_self_cmd = [
command!(system_server_avatar_self => "system_show_server_avatar_self")
.help("Shows your system's server avatar"),
command!(system_server_avatar_self, ("clear", ["c"]) => "system_clear_server_avatar")
.flag(("yes", ["y"]))
command!(system_server_avatar_self, CLEAR => "system_clear_server_avatar")
.flag(YES)
.help("Clears your system's server avatar"),
command!(system_server_avatar_self, ("avatar", Avatar) => "system_change_server_avatar")
.help("Changes your system's server avatar"),
@ -212,8 +212,8 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_banner_self_cmd = [
command!(system_banner_self => "system_show_banner_self")
.help("Shows your system's banner"),
command!(system_banner_self, ("clear", ["c"]) => "system_clear_banner")
.flag(("yes", ["y"]))
command!(system_banner_self, CLEAR => "system_clear_banner")
.flag(YES)
.help("Clears your system's banner"),
command!(system_banner_self, ("banner", Avatar) => "system_change_banner")
.help("Changes your system's banner"),
@ -243,7 +243,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_privacy_cmd = [
command!(system_privacy => "system_show_privacy")
.help("Shows your system's privacy settings"),
command!(system_privacy, ("all", ["a"]), ("level", PrivacyLevel) => "system_change_privacy_all")
command!(system_privacy, ALL, ("level", PrivacyLevel) => "system_change_privacy_all")
.help("Changes all privacy settings for your system"),
command!(system_privacy, ("privacy", SystemPrivacyTarget), ("level", PrivacyLevel) => "system_change_privacy")
.help("Changes a specific privacy setting for your system"),
@ -253,7 +253,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_front_cmd = [
command!(system_front => "system_fronter"),
command!(system_front, ("history", ["h"]) => "system_fronter_history")
.flag(("clear", ["c"])),
.flag(CLEAR),
command!(system_front, ("percent", ["p", "%"]) => "system_fronter_percent")
.flag(("duration", OpaqueString))
.flag(("fronters-only", ["fo"]))
@ -263,7 +263,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
let system_link = [
command!("link", ("account", UserRef) => "system_link"),
command!("unlink", ("account", OpaqueString) => "system_unlink").flag(("yes", ["y"])),
command!("unlink", ("account", OpaqueString) => "system_unlink").flag(YES),
]
.into_iter();

View file

@ -1,5 +1,7 @@
use command_parser::flag::Flag;
use crate::ALL;
pub fn get_list_flags() -> [Flag; 22] {
[
// Short or long list
@ -31,7 +33,7 @@ pub fn get_list_flags() -> [Flag; 22] {
// Sort reverse
Flag::from(("reverse", ["r", "rev"])),
// Privacy filter
Flag::from(("all", ["a"])),
Flag::from(ALL),
Flag::from(("private-only", ["po"])),
// Additional fields to include
Flag::from((