From daa0bdfad8551f157824700c97e890559b60e16c Mon Sep 17 00:00:00 2001 From: Kilari Teja Date: Mon, 12 Nov 2018 18:36:17 +0530 Subject: [PATCH] org_status.py: Fix export repo list bug Closes https://github.com/ksdme/org-status/issues/31 --- org_status/org_status.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/org_status/org_status.py b/org_status/org_status.py index e3e9207..e44d0dd 100644 --- a/org_status/org_status.py +++ b/org_status/org_status.py @@ -198,10 +198,12 @@ def main(): org_status = aggregate_org_status(org_host, threads=args.threads) present_status(org_status, args.no_color) - export_data = encode_repo_list(all_repositories, - args.format, - styled) - export_file = path.abspath(args.export_repos) + if args.export_repos: + export_data = encode_repo_list(all_repositories, args.format, styled) + export_file = path.abspath(args.export_repos) - if export_data is not None: - write_data_to_file(export_data, export_file, styled, verbose) + if len(all_repositories) > 0: + write_data_to_file(export_data, export_file, styled, verbose) + verbose(f'exported to {export_file}') + else: + verbose(f'exporting failed {export_file}')