Skip to content

Commit

Permalink
Bug Fix : name was not setting if command is set (#65)
Browse files Browse the repository at this point in the history
* default name was not used when a command was provided
  • Loading branch information
saurabhkpatel authored and dbieber committed Apr 19, 2017
1 parent d998200 commit 1f366f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion fire/core.py
Expand Up @@ -101,12 +101,13 @@ def Fire(component=None, command=None, name=None):
# Get args as a list.
if command is None:
# Use the command line args by default if no command is specified.
name = name or os.path.basename(sys.argv[0])
args = sys.argv[1:]
else:
# Otherwise use the specified command.
args = shlex.split(command)

name = name or os.path.basename(sys.argv[0])

# Determine the calling context.
caller = inspect.stack()[1]
caller_frame = caller[0]
Expand Down
5 changes: 3 additions & 2 deletions fire/fire_test.py
Expand Up @@ -324,8 +324,9 @@ def testHelpFlagAndTraceFlag(self):
fire.Fire(tc.BoolConverter, '-- -h --trace')

def testTabCompletionNoName(self):
with self.assertRaises(ValueError):
fire.Fire(tc.NoDefaults, '-- --completion')
completion_script = fire.Fire(tc.NoDefaults, '-- --completion')
self.assertIn('double', completion_script)
self.assertIn('triple', completion_script)

def testTabCompletion(self):
completion_script = fire.Fire(tc.NoDefaults, '-- --completion', name='c')
Expand Down

0 comments on commit 1f366f9

Please sign in to comment.