[mod] add a main function

This commit is contained in:
Laurent Peuch 2019-05-19 03:17:18 +02:00
parent 2725fba1f4
commit ec67f5af61

View file

@ -110,13 +110,13 @@ def ordered_yaml_load(stream):
return yaml.load(stream, OrderedLoader) return yaml.load(stream, OrderedLoader)
# creates output directory def main():
if not os.path.exists(OUTPUT_DIR): # creates output directory
if not os.path.exists(OUTPUT_DIR):
os.makedirs(OUTPUT_DIR) os.makedirs(OUTPUT_DIR)
# man pages of "yunohost *"
# man pages of "yunohost *" with open(ACTIONSMAP_FILE, 'r') as actionsmap:
with open(ACTIONSMAP_FILE, 'r') as actionsmap:
# Getting the dictionary containning what actions are possible per domain # Getting the dictionary containning what actions are possible per domain
actionsmap = ordered_yaml_load(actionsmap) actionsmap = ordered_yaml_load(actionsmap)
@ -134,5 +134,9 @@ with open(ACTIONSMAP_FILE, 'r') as actionsmap:
str=str, str=str,
) )
with open(os.path.join(OUTPUT_DIR, "yunohost"), "w") as output: with open(os.path.join(OUTPUT_DIR, "yunohost"), "w") as output:
output.write(result) output.write(result)
if __name__ == '__main__':
main()