From 62ccd164ff0557cd1a9fdc6a83ad7b0ee1768849 Mon Sep 17 00:00:00 2001 From: Evgeniy L Date: Thu, 14 Jan 2016 18:26:01 +0300 Subject: [PATCH] Add dst svg file generation parameter for cli --- bareon_dynamic_allocator/cmd.py | 11 ++++++++--- run.sh | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bareon_dynamic_allocator/cmd.py b/bareon_dynamic_allocator/cmd.py index 21f7095..02456cd 100644 --- a/bareon_dynamic_allocator/cmd.py +++ b/bareon_dynamic_allocator/cmd.py @@ -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__': diff --git a/run.sh b/run.sh index 1eb5a3b..dbc14eb 100644 --- a/run.sh +++ b/run.sh @@ -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