Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: -V now displays a short version string #1883

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/conky.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down