From 3216d85aaf0d472fc2b951eb02cd865063d0c148 Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 5 Mar 2019 22:29:36 +0100 Subject: [PATCH] Added --version. --- compilescript.1.adoc | 9 +++++---- src/main.cpp | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/compilescript.1.adoc b/compilescript.1.adoc index f655ad3..80c405e 100644 --- a/compilescript.1.adoc +++ b/compilescript.1.adoc @@ -35,10 +35,11 @@ The compiler invocation looks like this: == OPTIONS -[format="csv",frame="none",grid="none"] -|====== -*--cleanup*,Delete old cache files (older than +clean_after_hours+). -|====== +[frame="none",grid="none"] +|=== +|*--cleanup* | Delete old cache files (older than +clean_after_hours+). +|*--version* | Print version, copyright and license. +|=== == EXAMPLES diff --git a/src/main.cpp b/src/main.cpp index 8694a76..224cfe4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,5 @@ /* This file is part of compilescript. - * Copyright © 2018 tastytea + * Copyright © 2018, 2019 tastytea * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,6 +36,7 @@ #else namespace fs = std::experimental::filesystem; #endif +using std::cout; using std::cerr; using std::endl; using std::chrono::system_clock; @@ -134,7 +135,7 @@ int main(int argc, char *argv[]) if (argc <= 1) { - cerr << "usage: " << argv[0] << " [file|--cleanup] [arguments]\n"; + cerr << "usage: " << argv[0] << " [file|--cleanup|--version] [arguments]\n"; return 1; } if (string(argv[1]) == "--cleanup") @@ -142,6 +143,15 @@ int main(int argc, char *argv[]) cleanup(); return 0; } + if (string(argv[1]) == "--version") + { + cout << "compilescript " << global::version << endl << + "Copyright (C) 2018, 2019 tastytea \n" + "License GPLv3: GNU GPL version 3 .\n" + "This is free software: you are free to change and redistribute it.\n" + "There is NO WARRANTY, to the extent permitted by law.\n"; + return 0; + } const fs::path original = fs::canonical(argv[1]); const fs::path source = cache_dir / original;