Added --version.
This commit is contained in:
parent
32e17bff12
commit
3216d85aaf
|
@ -35,10 +35,11 @@ The compiler invocation looks like this: <configured compiler> <source file>
|
|||
|
||||
== 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
|
||||
|
||||
|
|
14
src/main.cpp
14
src/main.cpp
|
@ -1,5 +1,5 @@
|
|||
/* This file is part of compilescript.
|
||||
* Copyright © 2018 tastytea <tastytea@tastytea.de>
|
||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||
*
|
||||
* 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 <tastytea@tastytea.de>\n"
|
||||
"License GPLv3: GNU GPL version 3 <https://www.gnu.org/licenses/gpl-3.0.html>.\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;
|
||||
|
|
Reference in New Issue
Block a user