mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] add support to write gzip compressed man page
This commit is contained in:
parent
3e0dde747e
commit
3c074e637c
1 changed files with 8 additions and 2 deletions
|
@ -8,6 +8,7 @@ Pages are stored in OUTPUT_DIR
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import yaml
|
import yaml
|
||||||
|
import gzip
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
@ -113,6 +114,7 @@ def ordered_yaml_load(stream):
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="generate yunohost manpage based on actionsmap.yml")
|
parser = argparse.ArgumentParser(description="generate yunohost manpage based on actionsmap.yml")
|
||||||
parser.add_argument("-o", "--output", default="output/yunohost")
|
parser.add_argument("-o", "--output", default="output/yunohost")
|
||||||
|
parser.add_argument("-z", "--gzip", action="store_true", default=False)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
@ -148,8 +150,12 @@ def main():
|
||||||
str=str,
|
str=str,
|
||||||
)
|
)
|
||||||
|
|
||||||
with open(output_path, "w") as output:
|
if not args.gzip:
|
||||||
output.write(result)
|
with open(output_path, "w") as output:
|
||||||
|
output.write(result)
|
||||||
|
else:
|
||||||
|
with gzip.open(output_path, mode="w", compresslevel=9) as output:
|
||||||
|
output.write(result)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Add table
Reference in a new issue