Add dst svg file generation parameter for cli

This commit is contained in:
Evgeniy L 2016-01-14 18:26:01 +03:00
parent f308f2913f
commit 62ccd164ff
2 changed files with 9 additions and 4 deletions

View File

@ -37,7 +37,12 @@ cli_opts = [
'hw-info',
required=True,
help='Hardware information'
)
),
cfg.StrOpt(
'svg-file',
required=True,
help='Svg file is required for svg viewer'
),
]
@ -75,7 +80,7 @@ def parse_configs(conf):
def save_result(data, output_file):
viewer.StdoutViewer(data).show_me()
viewer.SVGViewer(data).show_me()
viewer.SVGViewer(data, file_path=output_file).show_me()
def validate_schema(schema):
@ -96,7 +101,7 @@ def allocator():
schema = DynamicAllocator(*conf).generate_static()
save_result(schema, CONF.file)
save_result(schema, CONF.svg_file)
if __name__ == '__main__':

2
run.sh
View File

@ -3,4 +3,4 @@
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
python bareon_dynamic_allocator/cmd.py --debug --schema etc/bareon-dynamic-allocator/simple_schema.yaml --file o.txt --hw-info etc/bareon-dynamic-allocator/example_2_disks.yaml
python bareon_dynamic_allocator/cmd.py --svg-file /tmp/bareon.svg --debug --schema etc/bareon-dynamic-allocator/simple_schema.yaml --file o.txt --hw-info etc/bareon-dynamic-allocator/example_2_disks.yaml