Release 0.1.0

This commit is contained in:
Leon Henrik Plickat 2022-06-01 18:00:45 +02:00
parent 27b7ccd1f1
commit 24307414ca
2 changed files with 21 additions and 1 deletions

11
wlopm.1
View File

@ -19,6 +19,11 @@ wlopm \- Wayland output power management
.OP \-\-help .OP \-\-help
.SY .SY
. .
.SY wlopm
.OP \-v
.OP \-\-version
.SY
.
. .
.SH DESCRIPTION .SH DESCRIPTION
.P .P
@ -36,6 +41,12 @@ Print help and exit.
.RE .RE
. .
.P .P
\fB-v\fR, \fB--version\fR
.RS
Print version and exit.
.RE
.
.P
\fB-j\fR, \fB--json\fR \fB-j\fR, \fB--json\fR
.RS .RS
Enable JSON formatting for listing outputs and errors encountered while trying Enable JSON formatting for listing outputs and errors encountered while trying

11
wlopm.c
View File

@ -35,12 +35,13 @@
#include "wlr-output-power-management-unstable-v1.h" #include "wlr-output-power-management-unstable-v1.h"
#define VERSION "0.0.1" #define VERSION "0.1.0"
const char usage[] = const char usage[] =
"Usage: wlopm [options...]\n" "Usage: wlopm [options...]\n"
" -j, --json Use JSON format.\n" " -j, --json Use JSON format.\n"
" -h, --help Print this help text and exit.\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" " --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" " --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" " --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); fputs(usage, stderr);
return EXIT_SUCCESS; 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 ) else if ( strcmp(argv[i], "-j") == 0 || strcmp(argv[i], "--json") == 0 )
json = true; json = true;
else if ( strcmp(argv[i], "--on") == 0 ) else if ( strcmp(argv[i], "--on") == 0 )