mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[mod] add a main function
This commit is contained in:
parent
2725fba1f4
commit
ec67f5af61
1 changed files with 28 additions and 24 deletions
|
@ -110,29 +110,33 @@ 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
|
||||||
os.makedirs(OUTPUT_DIR)
|
if not os.path.exists(OUTPUT_DIR):
|
||||||
|
os.makedirs(OUTPUT_DIR)
|
||||||
|
|
||||||
|
# man pages of "yunohost *"
|
||||||
|
with open(ACTIONSMAP_FILE, 'r') as actionsmap:
|
||||||
|
|
||||||
|
# Getting the dictionary containning what actions are possible per domain
|
||||||
|
actionsmap = ordered_yaml_load(actionsmap)
|
||||||
|
|
||||||
|
for i in actionsmap.keys():
|
||||||
|
if i.startswith("_"):
|
||||||
|
del actionsmap[i]
|
||||||
|
|
||||||
|
today = date.today()
|
||||||
|
|
||||||
|
result = template.render(
|
||||||
|
month=today.strftime("%B"),
|
||||||
|
year=today.year,
|
||||||
|
categories=actionsmap,
|
||||||
|
str=str,
|
||||||
|
)
|
||||||
|
|
||||||
|
with open(os.path.join(OUTPUT_DIR, "yunohost"), "w") as output:
|
||||||
|
output.write(result)
|
||||||
|
|
||||||
|
|
||||||
# man pages of "yunohost *"
|
if __name__ == '__main__':
|
||||||
with open(ACTIONSMAP_FILE, 'r') as actionsmap:
|
main()
|
||||||
|
|
||||||
# Getting the dictionary containning what actions are possible per domain
|
|
||||||
actionsmap = ordered_yaml_load(actionsmap)
|
|
||||||
|
|
||||||
for i in actionsmap.keys():
|
|
||||||
if i.startswith("_"):
|
|
||||||
del actionsmap[i]
|
|
||||||
|
|
||||||
today = date.today()
|
|
||||||
|
|
||||||
result = template.render(
|
|
||||||
month=today.strftime("%B"),
|
|
||||||
year=today.year,
|
|
||||||
categories=actionsmap,
|
|
||||||
str=str,
|
|
||||||
)
|
|
||||||
|
|
||||||
with open(os.path.join(OUTPUT_DIR, "yunohost"), "w") as output:
|
|
||||||
output.write(result)
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue