--help view displays a list of Main features and if they're used by the app (close #12)

This commit is contained in:
Martinez 2016-05-18 13:17:56 +02:00
parent d690632ca2
commit 7ae87629bf
2 changed files with 11 additions and 5 deletions

View file

@ -383,9 +383,9 @@ class ConfigFile:
class Main: class Main:
default_features = { default_features = {
"config_file": False, "config_file": (False, "Maintains and uses a config file in the XDG config directory (usually ~/config/appname)."),
"auto_add_help": True, "auto_add_help": (True, "Generates the program's help and state view."),
"handle_exceptions": True "handle_exceptions": (True, "Displays human-readable stack traces when unhandled exceptions are raised.")
} }
""" """
@ -417,7 +417,7 @@ class Main:
if feature_name in features: if feature_name in features:
self.features[feature_name] = features[feature_name] self.features[feature_name] = features[feature_name]
else: else:
self.features[feature_name] = self.default_features[feature_name] self.features[feature_name] = self.default_features[feature_name][0]
for feature_name in features: for feature_name in features:
if feature_name not in self.default_features: if feature_name not in self.default_features:
@ -529,6 +529,12 @@ class Main:
print(" <W>%s<.>-<c>%s<.> licensed under the <W>%s<.>" %(self.name, self.version, self.license)) print(" <W>%s<.>-<c>%s<.> licensed under the <W>%s<.>" %(self.name, self.version, self.license))
print(" using over-%s" %(version.str)) print(" using over-%s" %(version.str))
# Main features
print("")
print("[<W>over.app.Main features<.>]")
for feature_name in self.features:
print(" %s: <B>%s<.> (%s)" %(" <G>ON<.>" if self.features[feature_name] else "<R>OFF<.>", feature_name, self.default_features[feature_name][1]))
# App docs # App docs
print("") print("")
for chapter, paragraphs in (alternate_docs or self.docs).items(): for chapter, paragraphs in (alternate_docs or self.docs).items():

View file

@ -4,5 +4,5 @@
major = 1 # VERSION_MAJOR_IDENTIFIER major = 1 # VERSION_MAJOR_IDENTIFIER
minor = 99 # VERSION_MINOR_IDENTIFIER minor = 99 # VERSION_MINOR_IDENTIFIER
# VERSION_LAST_MM 1.99 # VERSION_LAST_MM 1.99
patch = 4 # VERSION_PATCH_IDENTIFIER patch = 5 # VERSION_PATCH_IDENTIFIER
str = ".".join(str(v) for v in (major, minor, patch)) str = ".".join(str(v) for v in (major, minor, patch))