diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2020-10-09 20:47:12 +0200 |
---|---|---|
committer | Philipp Maier <pmaier@sysmocom.de> | 2020-10-09 20:48:00 +0200 |
commit | 76795401fb9abda63e31c63ac80e3d5db2d810a3 (patch) | |
tree | caca1e61c5c7e7d6a1a93737871857bddb3d34dd /Transceiver52M | |
parent | 30863e8720459d38cdb0f2c7755e5be63aa0cc7b (diff) |
osmo-trx: add commandline option --vty-ref-xml
The commandline option --vty-ref-xml is needed to enable automatic
generation of the VTY reference manual.
Change-Id: I34dd36183e013ab005f39b235c4ab561590befb7
Related: SYS#4937, OS#1601
Diffstat (limited to 'Transceiver52M')
-rw-r--r-- | Transceiver52M/osmo-trx.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index 4a92447..c32f1ff 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -247,9 +247,10 @@ static void setup_signal_handlers() static void print_help() { fprintf(stdout, "Options:\n" - " -h, --help This text\n" - " -C, --config Filename The config file to use\n" - " -V, --version Print the version of OsmoTRX\n" + " -h, --help This text\n" + " -C, --config Filename The config file to use\n" + " -V, --version Print the version of OsmoTRX\n" + " --vty-ref-xml Generate the VTY reference XML output and exit.\n" ); } @@ -266,10 +267,12 @@ static void handle_options(int argc, char **argv, struct trx_ctx* trx) unsigned int i; std::vector<std::string> rx_paths, tx_paths; bool rx_paths_set = false, tx_paths_set = false; + static int long_option = 0; static struct option long_options[] = { {"help", 0, 0, 'h'}, {"config", 1, 0, 'C'}, {"version", 0, 0, 'V'}, + {"vty-ref-xml", 0, &long_option, 1}, {NULL, 0, 0, 0} }; @@ -280,6 +283,15 @@ static void handle_options(int argc, char **argv, struct trx_ctx* trx) print_help(); exit(0); break; + case 0: + switch (long_option) { + case 1: + vty_dump_xml_ref(stdout); + exit(0); + default: + fprintf(stderr, "error parsing cmdline options\n"); + exit(2); + } case 'a': print_deprecated(option); osmo_talloc_replace_string(trx, &trx->cfg.dev_args, optarg); |