aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--brightnessctl.c8
2 files changed, 8 insertions, 1 deletions
diff --git a/README.md b/README.md
index 68909ac..5aaa3ce 100644
--- a/README.md
+++ b/README.md
@@ -38,6 +38,7 @@ Options:
-h, --help print this help.
-d, --device=DEVICE specify device name.
-c, --class=CLASS specify device class.
+ -V, --version print version and exit.
Operations:
i, info get device info.
diff --git a/brightnessctl.c b/brightnessctl.c
index 0e16b0e..f169608 100644
--- a/brightnessctl.c
+++ b/brightnessctl.c
@@ -86,6 +86,7 @@ static const struct option options[] = {
{"pretend", no_argument, NULL, 'p'},
{"restore", no_argument, NULL, 'r'},
{"save", no_argument, NULL, 's'},
+ {"version", no_argument, NULL, 'V'},
{NULL,}
};
@@ -100,7 +101,7 @@ int main(int argc, char **argv) {
if (strcmp(name.sysname, "Linux"))
fail("This program only supports Linux.\n");
while (1) {
- if ((c = getopt_long(argc, argv, "lqpmsrhc:d:", options, NULL)) < 0)
+ if ((c = getopt_long(argc, argv, "lqpmsrhVc:d:", options, NULL)) < 0)
break;
switch (c) {
case 'l':
@@ -130,6 +131,10 @@ int main(int argc, char **argv) {
case 'd':
p.device = strdup(optarg);
break;
+ case 'V':
+ printf("%s\n", VERSION);
+ exit(0);
+ break;
default:
phelp++;
}
@@ -548,6 +553,7 @@ Options:\n\
-h, --help\t\t\tprint this help.\n\
-d, --device=DEVICE\t\tspecify device name.\n\
-c, --class=CLASS\t\tspecify device class.\n\
+ -V, --version\t\t\tprint version and exit.\n\
\n\
Operations:\n\
i, info\t\t\tget device info.\n\