M wlopm.1 => wlopm.1 +11 -0
@@ 19,6 19,11 @@ wlopm \- Wayland output power management
.OP \-\-help
.SY
.
+.SY wlopm
+.OP \-v
+.OP \-\-version
+.SY
+.
.
.SH DESCRIPTION
.P
@@ 36,6 41,12 @@ Print help and exit.
.RE
.
.P
+\fB-v\fR, \fB--version\fR
+.RS
+Print version and exit.
+.RE
+.
+.P
\fB-j\fR, \fB--json\fR
.RS
Enable JSON formatting for listing outputs and errors encountered while trying
M wlopm.c => wlopm.c +10 -1
@@ 35,12 35,13 @@
#include "wlr-output-power-management-unstable-v1.h"
-#define VERSION "0.0.1"
+#define VERSION "0.1.0"
const char usage[] =
"Usage: wlopm [options...]\n"
" -j, --json Use JSON format.\n"
" -h, --help Print this help text and exit.\n"
+ " -v, --version Print version and exit.\n"
" --on <output-name> Set the power mode of the specified output to on.\n"
" --off <output-name> Set the power mode of the specified output to off.\n"
" --toggle <output-name> Toggle the power mode of the specified output.\n"
@@ 464,6 465,14 @@ int main(int argc, char *argv[])
fputs(usage, stderr);
return EXIT_SUCCESS;
}
+ if ( strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0 )
+ {
+ {
+ destroy_all_operations();
+ fprintf(stderr, "wlopm version %s\n", VERSION);
+ return EXIT_SUCCESS;
+ }
+ }
else if ( strcmp(argv[i], "-j") == 0 || strcmp(argv[i], "--json") == 0 )
json = true;
else if ( strcmp(argv[i], "--on") == 0 )