bxctl: deny, another name for refuse

Implemented-By: OpenCode session (model recorded in docs/implementer-log.md)
This commit is contained in:
2026-09-24 04:11:01 -07:00
parent ebb78e816d
commit a5c37d8756
3 changed files with 47 additions and 1 deletions
+4 -1
View File
@@ -21,6 +21,9 @@ usage: bxctl <command> [options]
bxctl refuse <id> [--reason TEXT] [--admin-socket PATH]
Refuse approval <id>, recording a reason.
bxctl deny <id> [--reason TEXT] [--admin-socket PATH]
Another name for refuse.
bxctl grants check [--admin-socket PATH]
Check that the grants load.
@@ -98,7 +101,7 @@ pub fn parse(args: &[String], home: &Path) -> Result<Command, UsageError> {
"chat" => parse_chat(rest, home),
"approvals" => parse_approvals(rest, home),
"approve" => parse_approve(rest, home),
"refuse" => parse_refuse(rest, home),
"refuse" | "deny" => parse_refuse(rest, home),
"grants" => parse_grants(rest, home),
"audit" => parse_audit(rest, home),
// A flag before the command, or any unknown command, is not valid.
+42
View File
@@ -0,0 +1,42 @@
//! `bxctl deny` is another name for `bxctl refuse`: every argument list means the same under both
//! (M4b spec, section 2). Do not edit.
use bxctl::cli::{USAGE, parse};
use std::path::Path;
fn under(command: &str, rest: &[&str]) -> Vec<String> {
std::iter::once(command)
.chain(rest.iter().copied())
.map(str::to_string)
.collect()
}
#[test]
fn deny_parses_as_refuse() {
let cases: &[&[&str]] = &[
&["41"],
&["41", "--reason", "not on a Friday"],
&["--reason", "no", "41"],
&["41", "--admin-socket", "/tmp/a.sock"],
&["41", "--reason", "x", "--admin-socket", "/tmp/a.sock"],
&[],
&["x41"],
&["41", "--reason"],
&["41", "42"],
&["41", "--bogus"],
];
for rest in cases {
let home = Path::new("/srv/bx");
assert_eq!(
parse(&under("deny", rest), home),
parse(&under("refuse", rest), home),
"{rest:?}"
);
}
}
#[test]
fn usage_names_deny() {
assert!(USAGE.contains("bxctl deny <id>"), "{USAGE}");
assert!(USAGE.contains("bxctl refuse <id>"), "{USAGE}");
}