1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-16 18:15:17 +00:00

CLI: -V now displays a short version string

* -v shows the full version output with build details
 * -V (capital V) shows only the short version string
This commit is contained in:
Brenden Matthews 2024-05-01 14:26:59 -04:00
parent 17bc14f5fb
commit d8c8fd3de5
2 changed files with 10 additions and 5 deletions

View File

@ -2101,9 +2101,9 @@ const char *getopt_string =
;
const struct option longopts[] = {
{"help", 0, nullptr, 'h'}, {"version", 0, nullptr, 'V'},
{"quiet", 0, nullptr, 'q'}, {"debug", 0, nullptr, 'D'},
{"config", 1, nullptr, 'c'},
{"help", 0, nullptr, 'h'}, {"version", 0, nullptr, 'v'},
{"short-version", 0, nullptr, 'V'}, {"quiet", 0, nullptr, 'q'},
{"debug", 0, nullptr, 'D'}, {"config", 1, nullptr, 'c'},
#ifdef BUILD_BUILTIN_CONFIG
{"print-config", 0, nullptr, 'C'},
#endif

View File

@ -56,6 +56,8 @@
#endif /* BUILD_OLD_CONFIG */
#endif /* BUILD_BUILTIN_CONFIG */
static void print_short_version() { std::cout << VERSION << std::endl; }
static void print_version() {
std::cout << _(PACKAGE_NAME " " VERSION " compiled for " BUILD_ARCH
"\n"
@ -232,7 +234,8 @@ static void print_help(const char *prog_name) {
"window. Command line options will override configurations defined in "
"config\n"
"file.\n"
" -v, --version version\n"
" -v, --version version with build details\n"
" -V, --short-version short version\n"
" -q, --quiet quiet mode\n"
" -D, --debug increase debugging output, ie. -DD for "
"more debugging\n"
@ -320,9 +323,11 @@ int main(int argc, char **argv) {
global_debug_level++;
break;
case 'v':
case 'V':
print_version();
return EXIT_SUCCESS;
case 'V':
print_short_version();
return EXIT_SUCCESS;
case 'c':
current_config = optarg;
break;