Drop -m/-u/-c short options for --mount/--umount/--cleanup

Now that -r/--run and -x/--exec cover normal use, --mount/--umount/--cleanup
are debug-only escape hatches not worth a short letter. Reassigned their
long_options codes to long-option-only constants (options::mount/umount/
cleanup) and dropped m:/u:/c: from getopt_long's own short-options string.

Updated the fixture smoke test (tests/run_test.py) and docs, which invoked
-m/-u/-c directly.
This commit is contained in:
2026-09-05 08:43:58 +00:00
parent cdf9dcd210
commit d2d631117d
5 changed files with 59 additions and 41 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ def run(slocker_lite: str, *args: str) -> subprocess.CompletedProcess:
def main() -> int:
slocker_lite, fixture_tar = sys.argv[1], sys.argv[2]
mount = run(slocker_lite, "-m", fixture_tar)
mount = run(slocker_lite, "--mount", fixture_tar)
if mount.returncode != 0:
print(mount.stderr, file=sys.stderr)
return mount.returncode
@@ -26,7 +26,7 @@ def main() -> int:
return 1
layer_id = match.group(1)
for args in (("-u", layer_id), ("-c", layer_id)):
for args in (("--umount", layer_id), ("--cleanup", layer_id)):
result = run(slocker_lite, *args)
if result.returncode != 0:
print(result.stderr, file=sys.stderr)
+9 -3
View File
@@ -56,13 +56,19 @@ ParseResult run_parse(const std::vector<std::string>& args) {
} // namespace
TEST_CASE("parse_args: -m <image.tar> selects Mode::mount", "[unit]") {
auto result = run_parse({"-m", "image.tar"});
TEST_CASE("parse_args: --mount <image.tar> selects Mode::mount", "[unit]") {
auto result = run_parse({"--mount", "image.tar"});
REQUIRE_FALSE(result.exit_code.has_value());
CHECK(result.args.mode == Mode::mount);
CHECK(result.args.mode_arg == "image.tar");
}
TEST_CASE("parse_args: -m is no longer a recognized short option", "[unit]") {
auto result = run_parse({"-m", "image.tar"});
REQUIRE(result.exit_code.has_value());
CHECK(*result.exit_code == 1);
}
TEST_CASE("parse_args: -h returns exit code 0 immediately", "[unit]") {
auto result = run_parse({"-h"});
REQUIRE(result.exit_code.has_value());
@@ -82,7 +88,7 @@ TEST_CASE("parse_args: no mode at all is a parse error", "[unit]") {
}
TEST_CASE("parse_args: two actions on the same command line is a parse error", "[unit]") {
auto result = run_parse({"-m", "a.tar", "-l", "dir"});
auto result = run_parse({"--mount", "a.tar", "-l", "dir"});
REQUIRE(result.exit_code.has_value());
CHECK(*result.exit_code == 1);
}