From b88e8399787c949b164643c6b218196368fb9036 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Sun, 7 May 2017 01:32:31 +0200 Subject: [PATCH] Add feature flags to filter help messages --- src/helpers/help.cpp | 250 ++++++++++++++++++++++++++----------------- src/helpers/help.h | 32 ++++++ 2 files changed, 183 insertions(+), 99 deletions(-) diff --git a/src/helpers/help.cpp b/src/helpers/help.cpp index 404fd0e..7de95c2 100644 --- a/src/helpers/help.cpp +++ b/src/helpers/help.cpp @@ -8,39 +8,63 @@ using namespace std; namespace help { + inline KeyboardFeatures operator|(KeyboardFeatures a, KeyboardFeatures b) { + return static_cast(static_cast(a) | static_cast(b)); + } + + KeyboardFeatures getKeyboardFeatures(string cmdName) { + if(cmdName == "g213-led") return KeyboardFeatures::g213; + else if(cmdName == "g410-led") return KeyboardFeatures::g410; + else if(cmdName == "g610-led") return KeyboardFeatures::g610; + else if(cmdName == "g810-led") return KeyboardFeatures::g810; + else if(cmdName == "g910-led") return KeyboardFeatures::g910; + return KeyboardFeatures::all; + } + + void usage(char *arg0) { string cmdName = utils::getCmdName(arg0); + KeyboardFeatures features = getKeyboardFeatures(cmdName); cout<