summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-11-29 11:03:07 +0100
committerDavid Robillard <d@drobilla.net>2020-11-29 12:00:37 +0100
commit47e6e67ecfcc2015c8e1112938d4e9fae4fb92f1 (patch)
treed13b821c51d49ba8b6a41864651e2f6a9118970d
parent6d71c2f83b7fef4956f04e277a905d45de249745 (diff)
downloadpatchage-47e6e67ecfcc2015c8e1112938d4e9fae4fb92f1.tar.gz
patchage-47e6e67ecfcc2015c8e1112938d4e9fae4fb92f1.tar.bz2
patchage-47e6e67ecfcc2015c8e1112938d4e9fae4fb92f1.zip
Add command line option to print version
-rw-r--r--NEWS3
-rw-r--r--doc/patchage.14
-rw-r--r--src/main.cpp14
3 files changed, 20 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index a3e0c95..8882fda 100644
--- a/NEWS
+++ b/NEWS
@@ -1,11 +1,12 @@
patchage (1.0.3) unstable;
+ * Add command line option to print version
* Fix making and breaking connections with Jack DBus
* Fix sample rate with Jack DBus
* Improve man page
* Remove Jack session support
- -- David Robillard <d@drobilla.net> Sun, 29 Nov 2020 10:00:53 +0000
+ -- David Robillard <d@drobilla.net> Sun, 29 Nov 2020 10:02:25 +0000
patchage (1.0.2) stable;
diff --git a/doc/patchage.1 b/doc/patchage.1
index f99eb92..210ea0b 100644
--- a/doc/patchage.1
+++ b/doc/patchage.1
@@ -24,5 +24,9 @@ Print the command line options and exit.
\fB\-J\fR, \fB\-\-no\-jack\fR
Do not automatically attach to JACK.
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Print version information and exit.
+
.SH AUTHOR
Patchage was written by David Robillard <d@drobilla.net>
diff --git a/src/main.cpp b/src/main.cpp
index db4721b..2763852 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -82,6 +82,17 @@ print_usage()
std::cout << " -J, --no-jack Do not automatically attack to JACK.\n";
}
+void
+print_version()
+{
+ std::cout << "Patchage " PATCHAGE_VERSION << R"(
+Copyright 2007-2020 David Robillard <d@drobilla.net>.
+License GPLv3+: <http://gnu.org/licenses/gpl.html>.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+)";
+}
+
} // namespace
int
@@ -111,6 +122,9 @@ main(int argc, char** argv)
options.alsa_driver_autoattach = false;
} else if (!strcmp(*argv, "-J") || !strcmp(*argv, "--no-jack")) {
options.jack_driver_autoattach = false;
+ } else if (!strcmp(*argv, "-V") || !strcmp(*argv, "--version")) {
+ print_version();
+ return 0;
} else {
std::cerr << "patchage: invalid option -- '" << *argv << "'\n";
print_usage();