-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
95 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/_* | ||
/src/_version.h | ||
/CMakeLists.txt.user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
#include "Settings.h" | ||
#include <cstdio> | ||
|
||
bool interpret_commandline(Settings& settings, int argc, char* argv[]) { | ||
for (auto i = 1; i < argc; i++) { | ||
const auto argument = std::string(argv[i]); | ||
if (argument == "-v" || argument == "--verbose") { | ||
settings.verbose = true; | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
void print_help_message(const char* argv0) { | ||
auto program = std::string(argv0); | ||
if (auto i = program.rfind('/'); i != std::string::npos) | ||
program = program.substr(i + 1); | ||
if (auto i = program.rfind('.'); i != std::string::npos) | ||
program = program.substr(0, i); | ||
|
||
const auto version = | ||
#if __has_include("../../_version.h") | ||
# include "../../_version.h" | ||
" "; | ||
#else | ||
""; | ||
#endif | ||
|
||
std::printf( | ||
"keymapperd %s(c) 2019-2021 by Albert Kalchmair\n" | ||
"\n" | ||
"Usage: %s [-options]\n" | ||
" -v, --verbose enable verbose output.\n" | ||
"\n" | ||
"All Rights Reserved.\n" | ||
"This program comes with absolutely no warranty.\n" | ||
"See the GNU General Public License, version 3 for details.\n" | ||
"\n", version, program.c_str()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
struct Settings { | ||
bool verbose; | ||
}; | ||
|
||
bool interpret_commandline(Settings& settings, int argc, char* argv[]); | ||
void print_help_message(const char* arg0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"${GIT_COMMIT_LAST_TAG}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters