cli: Add new write-protect CLI
Add a new write-protect CLI that is based on the classic-CLI feature
in flashrom/master. The syntax is slighty different: With the new
CLI wrapper, we can either call it as `flashprog write-protect` or
`flashprog wp`. To keep the CLI code clean, we allow only one write-
protection operation per call.
For instance, the write-protection status can then be queried like
this:
$ flashprog wp status -p ch341a_spi
Change-Id: I32818b58c9db939719913fc63063c41a27876554
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/72991
diff --git a/cli.c b/cli.c
index f1d483a..49e0c60 100644
--- a/cli.c
+++ b/cli.c
@@ -28,6 +28,8 @@
{ "prog", flashprog_classic_main },
{ "cfg", flashprog_config_main },
{ "config", flashprog_config_main },
+ { "wp", flashprog_wp_main },
+ { "write-protect", flashprog_wp_main },
};
static void usage(const char *const name)
@@ -37,6 +39,7 @@
" prog Standard memory operations\n"
" (read/erase/write/verify)\n"
" cfg | config Status/config register operations\n"
+ " wp | write-protect Write-protection operations\n"
"\n"
"The default is 'prog'. See `%s <command> --help`\n"
"for further instructions.\n\n", name);