From 746f0677720e23ec26b168bf093ff2d559bfec81 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Tue, 15 Nov 2016 01:56:51 +0100 Subject: [PATCH] Try again. --- vigil | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/vigil b/vigil index 46d9be7..7be817e 100755 --- a/vigil +++ b/vigil @@ -922,6 +922,8 @@ def main(root_path, loop, worker_count=None, is_sandboxed=True, editor_command=None, theme=None, is_being_tested=False): if worker_count is None: worker_count = multiprocessing.cpu_count() + if theme is None: + theme = "native" os.environ["PYGMENT_STYLE"] = theme pickle_path = os.path.join(tools.CACHE_PATH, "summary.pickle") jobs_added_event = asyncio.Event() @@ -1007,15 +1009,15 @@ def check_arguments(): print("--sandbox argument must be 'on' or 'off'") sys.exit(1) is_sandboxed = arguments["--sandbox"] in ["on", None] - theme = ("native" if arguments["--theme"] is None - else arguments["--theme"]) - themes = list(pygments.styles.get_all_styles()) - if theme not in themes: - print("--theme must be one of: %s" % " ".join(themes)) - sys.exit(1) + if arguments["--theme"] is not None: + themes = list(pygments.styles.get_all_styles()) + if arguments["--theme"] not in themes: + print("--theme must be one of: %s" % " ".join(themes)) + sys.exit(1) editor_command = arguments["--editor"] or os.environ.get("EDITOR", None)\ or os.environ.get("VISUAL", None) - return root_path, worker_count, is_sandboxed, editor_command, theme + return root_path, worker_count, is_sandboxed, editor_command, \ + arguments["--theme"] if __name__ == "__main__":