mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-08 06:47:56 +00:00
better parameters handling, implement import export
This commit is contained in:
parent
e4f38c76a9
commit
5198f7d83b
19 changed files with 250 additions and 174 deletions
|
|
@ -158,9 +158,9 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
.map(apply_list_opts);
|
||||
|
||||
let group_modify_members_cmd = [
|
||||
command!(group_target, "add", MemberRefs => "group_add_member")
|
||||
command!(group_target, "add", Optional(MemberRefs) => "group_add_member")
|
||||
.flag(("all", ["a"])),
|
||||
command!(group_target, ("remove", ["delete", "del", "rem"]), MemberRefs => "group_remove_member")
|
||||
command!(group_target, ("remove", ["delete", "del", "rem"]), Optional(MemberRefs) => "group_remove_member")
|
||||
.flag(("all", ["a"])),
|
||||
]
|
||||
.into_iter();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ use super::*;
|
|||
pub fn cmds() -> impl Iterator<Item = Command> {
|
||||
let help = ("help", ["h"]);
|
||||
[
|
||||
command!(("dashboard", ["dash"]) => "dashboard"),
|
||||
command!("explain" => "explain"),
|
||||
command!(help => "help")
|
||||
.flag(("foo", OpaqueString)) // todo: just for testing
|
||||
|
|
|
|||
|
|
@ -1 +1,9 @@
|
|||
use super::*;
|
||||
|
||||
pub fn cmds() -> impl Iterator<Item = Command> {
|
||||
[
|
||||
command!("import", Optional(("url", OpaqueStringRemainder)) => "import"),
|
||||
command!("export" => "export"),
|
||||
]
|
||||
.into_iter()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,12 @@ pub mod system;
|
|||
|
||||
pub mod utils;
|
||||
|
||||
use command_parser::{command, command::Command, parameter::ParameterKind::*, tokens};
|
||||
use command_parser::{
|
||||
command,
|
||||
command::Command,
|
||||
parameter::{Optional, Parameter, ParameterKind::*, Remainder, Skip},
|
||||
tokens,
|
||||
};
|
||||
|
||||
pub fn all() -> impl Iterator<Item = Command> {
|
||||
(help::cmds())
|
||||
|
|
@ -34,6 +39,7 @@ pub fn all() -> impl Iterator<Item = Command> {
|
|||
.chain(autoproxy::cmds())
|
||||
.chain(debug::cmds())
|
||||
.chain(message::cmds())
|
||||
.chain(import_export::cmds())
|
||||
.map(|cmd| {
|
||||
cmd.hidden_flag(("plaintext", ["pt"]))
|
||||
.hidden_flag(("raw", ["r"]))
|
||||
|
|
|
|||
|
|
@ -182,11 +182,11 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
[
|
||||
command!(member_keep_proxy => "member_keepproxy_show")
|
||||
.help("Shows a member's keep-proxy setting"),
|
||||
command!(member_keep_proxy, ("value", Toggle) => "member_keepproxy_update")
|
||||
command!(member_keep_proxy, Skip(("value", Toggle)) => "member_keepproxy_update")
|
||||
.help("Changes a member's keep-proxy setting"),
|
||||
command!(member_server_keep_proxy => "member_server_keepproxy_show")
|
||||
.help("Shows a member's server-specific keep-proxy setting"),
|
||||
command!(member_server_keep_proxy, ("value", Toggle) => "member_server_keepproxy_update")
|
||||
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"]))
|
||||
|
|
@ -303,9 +303,9 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
.map(|cmd| cmd.flags(get_list_flags()));
|
||||
|
||||
let member_add_remove_group_cmds = [
|
||||
command!(member_group, "add", ("groups", GroupRefs) => "member_group_add")
|
||||
command!(member_group, "add", Optional(("groups", GroupRefs)) => "member_group_add")
|
||||
.help("Adds a member to one or more groups"),
|
||||
command!(member_group, ("remove", ["rem"]), ("groups", GroupRefs) => "member_group_remove")
|
||||
command!(member_group, ("remove", ["rem"]), Optional(("groups", GroupRefs)) => "member_group_remove")
|
||||
.help("Removes a member from one or more groups"),
|
||||
]
|
||||
.into_iter();
|
||||
|
|
|
|||
|
|
@ -9,23 +9,22 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
let copy = ("copy", ["add", "duplicate", "dupe"]);
|
||||
let out = "out";
|
||||
|
||||
let edit_flags = [
|
||||
("first", ["f"]),
|
||||
("remove", ["r"]),
|
||||
("append", ["a"]),
|
||||
("prepend", ["p"]),
|
||||
];
|
||||
|
||||
[
|
||||
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"),
|
||||
command!(switch, edit, MemberRefs => "switch_edit")
|
||||
.flag(("first", ["f"]))
|
||||
.flag(("remove", ["r"]))
|
||||
.flag(("append", ["a"]))
|
||||
.flag(("prepend", ["p"])),
|
||||
command!(switch, copy, MemberRefs => "switch_copy")
|
||||
.flag(("first", ["f"]))
|
||||
.flag(("remove", ["r"]))
|
||||
.flag(("append", ["a"]))
|
||||
.flag(("prepend", ["p"])),
|
||||
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"),
|
||||
command!(switch, MemberRefs => "switch_do"),
|
||||
command!(switch, Optional(MemberRefs) => "switch_do"),
|
||||
]
|
||||
.into_iter()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
|||
let system_proxy_cmd = [
|
||||
command!(system_proxy => "system_show_proxy_current")
|
||||
.help("Shows your system's proxy setting for the guild you are in"),
|
||||
command!(system_proxy, Toggle => "system_toggle_proxy_current")
|
||||
command!(system_proxy, Skip(Toggle) => "system_toggle_proxy_current")
|
||||
.help("Toggle your system's proxy for the guild you are in"),
|
||||
command!(system_proxy, GuildRef => "system_show_proxy")
|
||||
.help("Shows your system's proxy setting for a guild"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue