make fronthistory and frontpercent work in system commands

This commit is contained in:
dusk 2025-11-23 15:05:12 +00:00
parent 960f735db9
commit e9933c36ce
No known key found for this signature in database

View file

@ -250,18 +250,26 @@ pub fn edit() -> impl Iterator<Item = Command> {
let front = ("front", ["fronter", "fronters", "f"]); let front = ("front", ["fronter", "fronters", "f"]);
let make_system_front_cmd = |prefix: TokensIterator, suffix: &str| { let make_system_front_cmd = |prefix: TokensIterator, suffix: &str| {
[ let make_front_history = |subcmd: TokensIterator| {
command!(prefix => format!("system_fronter{}", suffix)), command!(prefix, subcmd => format!("system_fronter_history{}", suffix)).flag(CLEAR)
command!(prefix, ("history", ["h"]) => format!("system_fronter_history{}", suffix)).flag(CLEAR), };
command!(prefix, ("percent", ["p", "%"]) => format!("system_fronter_percent{}", suffix)) let make_front_percent = |subcmd: TokensIterator| {
command!(prefix, subcmd => format!("system_fronter_percent{}", suffix))
.flag(("duration", OpaqueString)) .flag(("duration", OpaqueString))
.flag(("fronters-only", ["fo"])) .flag(("fronters-only", ["fo"]))
.flag("flat"), .flag("flat")
};
[
command!(prefix, front => format!("system_fronter{}", suffix)),
make_front_history(tokens!(front, ("history", ["h"]))),
make_front_history(tokens!(("fronthistory", ["fh"]))),
make_front_percent(tokens!(front, ("percent", ["p", "%"]))),
make_front_percent(tokens!(("frontpercent", ["fp"]))),
] ]
.into_iter() .into_iter()
}; };
let system_front_cmd = make_system_front_cmd(tokens!(system_target, front), ""); let system_front_cmd = make_system_front_cmd(tokens!(system_target), "");
let system_front_self_cmd = make_system_front_cmd(tokens!(system, front), "_self"); let system_front_self_cmd = make_system_front_cmd(tokens!(system), "_self");
let system_link = [ let system_link = [
command!("link", ("account", UserRef) => "system_link"), command!("link", ("account", UserRef) => "system_link"),