mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-10 15:57:53 +00:00
add missing -yes flags to command definitions, use log crate instead of printlns in command parser, also accept double dash for flags
This commit is contained in:
parent
8431255930
commit
12655fb539
16 changed files with 130 additions and 53 deletions
|
|
@ -16,7 +16,8 @@ pub fn cmds() -> impl IntoIterator<Item = Command> {
|
|||
command!(ap_account, Toggle => "cfg_ap_account_update")
|
||||
.help("Toggles autoproxy globally for the current account"),
|
||||
command!(ap_timeout => "cfg_ap_timeout_show").help("Shows the autoproxy timeout"),
|
||||
command!(ap_timeout, RESET => "cfg_ap_timeout_reset").help("Resets the autoproxy timeout"),
|
||||
command!(ap_timeout, RESET => "cfg_ap_timeout_reset")
|
||||
.help("Resets the autoproxy timeout"),
|
||||
command!(ap_timeout, parameter::Toggle::Off => "cfg_ap_timeout_off")
|
||||
.help("Disables the autoproxy timeout"),
|
||||
command!(ap_timeout, ("timeout", OpaqueString) => "cfg_ap_timeout_update")
|
||||
|
|
@ -26,8 +27,10 @@ pub fn cmds() -> impl IntoIterator<Item = Command> {
|
|||
let timezone_tokens = tokens!(cfg, ("timezone", ["zone", "tz"]));
|
||||
let timezone = [
|
||||
command!(timezone_tokens => "cfg_timezone_show").help("Shows the system timezone"),
|
||||
command!(timezone_tokens, RESET => "cfg_timezone_reset").help("Resets the system timezone"),
|
||||
command!(timezone_tokens, RESET => "cfg_timezone_reset")
|
||||
.help("Resets the system timezone"),
|
||||
command!(timezone_tokens, ("timezone", OpaqueString) => "cfg_timezone_update")
|
||||
.flag(YES)
|
||||
.help("Changes your system's time zone"),
|
||||
];
|
||||
|
||||
|
|
@ -168,7 +171,8 @@ pub fn cmds() -> impl IntoIterator<Item = Command> {
|
|||
let name_format_short = tokens!(cfg, ("nameformat", ["nf"]));
|
||||
let name_formatting = [
|
||||
command!(name_format => "cfg_name_format_show").help("Shows the name format"),
|
||||
command!(name_format, RESET => "cfg_name_format_reset").help("Resets the name format"),
|
||||
command!(name_format, RESET => "cfg_name_format_reset")
|
||||
.help("Resets the name format"),
|
||||
command!(name_format, ("format", OpaqueString) => "cfg_name_format_update")
|
||||
.help("Changes your system's username formatting"),
|
||||
command!(name_format_short => "cfg_name_format_show").help("Shows the name format"),
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
let group_new = tokens!(group, ("new", ["n"]));
|
||||
let group_new_cmd = once(
|
||||
command!(group_new, Remainder(("name", OpaqueString)) => "group_new")
|
||||
.flag(YES)
|
||||
.help("Creates a new group"),
|
||||
);
|
||||
|
||||
|
|
@ -37,9 +38,9 @@ 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 => "group_clear_name")
|
||||
.flag(YES)
|
||||
.help("Clears the group's name"),
|
||||
command!(group_name, Remainder(("name", OpaqueString)) => "group_rename")
|
||||
.flag(YES)
|
||||
.help("Renames a group"),
|
||||
];
|
||||
|
||||
|
|
@ -48,7 +49,6 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
command!(group_display_name => "group_show_display_name")
|
||||
.help("Shows the group's display name"),
|
||||
command!(group_display_name, CLEAR => "group_clear_display_name")
|
||||
.flag(YES)
|
||||
.help("Clears the group's display name"),
|
||||
command!(group_display_name, Remainder(("name", OpaqueString)) => "group_change_display_name")
|
||||
.help("Changes the group's display name"),
|
||||
|
|
@ -65,7 +65,6 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
command!(group_description => "group_show_description")
|
||||
.help("Shows the group's description"),
|
||||
command!(group_description, CLEAR => "group_clear_description")
|
||||
.flag(YES)
|
||||
.help("Clears the group's description"),
|
||||
command!(group_description, Remainder(("description", OpaqueString)) => "group_change_description")
|
||||
.help("Changes the group's description"),
|
||||
|
|
@ -98,7 +97,6 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
let group_color_cmd = [
|
||||
command!(group_color => "group_show_color").help("Shows the group's color"),
|
||||
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 a group's color"),
|
||||
|
|
@ -126,7 +124,6 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
|
||||
let group_delete_cmd = [
|
||||
command!(group_target, ("delete", ["destroy", "erase", "yeet"]) => "group_delete")
|
||||
.flag(YES)
|
||||
.help("Deletes a group"),
|
||||
];
|
||||
|
||||
|
|
@ -151,7 +148,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
let group_modify_members_cmd = [
|
||||
command!(group_target, "add", Optional(MemberRefs) => "group_add_member")
|
||||
.help("Adds one or more members to a group")
|
||||
.flag(ALL).flag(YES),
|
||||
.flag(ALL),
|
||||
command!(group_target, ("remove", ["rem", "rm"]), Optional(MemberRefs) => "group_remove_member")
|
||||
.help("Removes one or more members from a group")
|
||||
.flag(ALL).flag(YES),
|
||||
|
|
|
|||
|
|
@ -36,7 +36,9 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
let delete = ("delete", ["del", "remove"]);
|
||||
|
||||
let member_new_cmd = once(
|
||||
command!(member, new, ("name", OpaqueString) => "member_new").help("Creates a new member"),
|
||||
command!(member, new, ("name", OpaqueString) => "member_new")
|
||||
.flag(YES)
|
||||
.help("Creates a new member"),
|
||||
);
|
||||
|
||||
let member_info_cmd = once(
|
||||
|
|
@ -161,6 +163,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
command!(member_proxy => "member_proxy_show")
|
||||
.help("Shows a member's proxy tags"),
|
||||
command!(member_proxy, ("add", ["a"]), ("tag", OpaqueString) => "member_proxy_add")
|
||||
.flag(YES)
|
||||
.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"),
|
||||
|
|
@ -168,6 +171,7 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
.flag(YES)
|
||||
.help("Clears all proxy tags from a member"),
|
||||
command!(member_proxy, Remainder(("tags", OpaqueString)) => "member_proxy_set")
|
||||
.flag(YES)
|
||||
.help("Sets a member's proxy tags"),
|
||||
]
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use crate::utils::get_list_flags;
|
|||
use super::*;
|
||||
|
||||
pub fn cmds() -> impl Iterator<Item = Command> {
|
||||
let random = ("random", ["rand"]);
|
||||
let random = ("random", ["rand", "r"]);
|
||||
let group = group::group();
|
||||
let member = member::member();
|
||||
|
||||
|
|
|
|||
|
|
@ -21,14 +21,17 @@ pub fn cmds() -> impl IntoIterator<Item = Command> {
|
|||
.help("Shows help for switch commands"),
|
||||
command!(switch, out => "switch_out").help("Registers a switch with no members"),
|
||||
command!(switch, delete => "switch_delete")
|
||||
.flag(YES)
|
||||
.help("Deletes the latest switch")
|
||||
.flag(("all", ["clear", "c"])),
|
||||
command!(switch, r#move, Remainder(OpaqueString) => "switch_move")
|
||||
.flag(YES)
|
||||
.help("Moves the latest switch in time"), // TODO: datetime parsing
|
||||
command!(switch, edit, out => "switch_edit_out")
|
||||
.help("Turns the latest switch into a switch-out")
|
||||
.flag(YES),
|
||||
command!(switch, edit, Optional(MemberRefs) => "switch_edit")
|
||||
.flag(YES)
|
||||
.help("Edits the members in the latest switch")
|
||||
.flags(edit_flags),
|
||||
command!(switch, copy, Optional(MemberRefs) => "switch_copy")
|
||||
|
|
|
|||
|
|
@ -230,15 +230,24 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
|||
command!(system, Optional(SystemRef), front => "system_fronter")
|
||||
.help("Shows a system's fronter(s)"),
|
||||
make_front_history(tokens!(front, ("history", ["h"]))),
|
||||
make_front_history(tokens!(("fronthistory", ["fh"]))),
|
||||
make_front_history(tokens!(("fronthistory", ["fh", "history", "switches"]))),
|
||||
make_front_percent(tokens!(front, ("percent", ["p", "%"]))),
|
||||
make_front_percent(tokens!(("frontpercent", ["fp"]))),
|
||||
make_front_percent(tokens!((
|
||||
"frontpercent",
|
||||
["fp", "front%", "frontbreakdown"]
|
||||
))),
|
||||
];
|
||||
|
||||
let search_param = Optional(Remainder(("query", OpaqueString)));
|
||||
let apply_list_opts = |cmd: Command| cmd.flags(get_list_flags());
|
||||
|
||||
let members_subcmd = tokens!(("members", ["l", "ls", "list"]), search_param);
|
||||
let members_subcmd = tokens!(
|
||||
(
|
||||
"members",
|
||||
["l", "ls", "list", "find", "search", "query", "fd"]
|
||||
),
|
||||
search_param
|
||||
);
|
||||
let system_members_cmd = [
|
||||
command!(system, Optional(SystemRef), members_subcmd => "system_members")
|
||||
.help("Lists a system's members"),
|
||||
|
|
@ -265,6 +274,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
|||
|
||||
let system_link = [
|
||||
command!("link", ("account", UserRef) => "system_link")
|
||||
.flag(YES)
|
||||
.help("Links another Discord account to your system"),
|
||||
command!("unlink", ("account", OpaqueString) => "system_unlink")
|
||||
.help("Unlinks a Discord account from your system")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue