From 9b39e21be435dd9c1a15681887587e94bd4952d5 Mon Sep 17 00:00:00 2001 From: Wei-Chung Liao Date: Mon, 26 Apr 2021 01:18:24 -0400 Subject: [PATCH] Fix completion for Fire(fn) --- fire/completion.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fire/completion.py b/fire/completion.py index ed7a1b61..9659ec6a 100644 --- a/fire/completion.py +++ b/fire/completion.py @@ -156,7 +156,11 @@ def _GetOptsAssignmentTemplate(command): return opts_assignment_subcommand_template lines = [] - for command in set(subcommands_map.keys()).union(set(options_map.keys())): + commands_set = set() + commands_set.add(name) + commands_set = commands_set.union(set(subcommands_map.keys())) + commands_set = commands_set.union(set(options_map.keys())) + for command in commands_set: opts_assignment = _GetOptsAssignmentTemplate(command).format( options=' '.join( sorted(options_map[command].union(subcommands_map[command]))