Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion Enhancements #144

Merged
merged 10 commits into from
Feb 21, 2019
Merged

Completion Enhancements #144

merged 10 commits into from
Feb 21, 2019

Conversation

meshde
Copy link
Contributor

@meshde meshde commented Oct 13, 2018

Introduction

This PR changes the completion scripts that are generated by running the --completion option for the Fire generated commands. The changes are aimed to give more flexibility to the user.

Main Changes

  • The highlight of this PR is the shift from using start based completion to last-command based completion.
  • In the start based completion, the entire string that has been entered into the command prompt so far is used to map the completion suggestions. This creates inflexibility for the user, causing completion can not tab hint and complete the second param? #136.
  • In the last-command based completion, suggestions are based on the last command/subcommand (non-option arg) entered by the user. This gives flexibility to the user, to be able to use options in any order, thereby fixing completion can not tab hint and complete the second param? #136.

Features

The features added are:

  • Ability to use options in any order.
  • Options that are already entered are not shown in the suggestion list.
  • The completion script abides by the usage of Fire generated CLI commands, such that function arguments are removed from the suggestion list once a module level option (or global option) is entered. In other words, module options come either before a function or after it's arguments (see guide)
  • All the above included for both: bash & fish

@dbieber
Copy link
Member

dbieber commented Oct 13, 2018

This is great, thanks for the PR! I'll take a closer look after the weekend.

@dbieber
Copy link
Member

dbieber commented Oct 29, 2018

Apologies for the delay; I haven't had a chance to look in detail at this yet.

@meshde
Copy link
Contributor Author

meshde commented Oct 30, 2018

No worries 😄

In the meantime, I could also have a look at #148 and resolve it in the same PR.

@dbieber
Copy link
Member

dbieber commented Oct 30, 2018

That would be awesome :)

@dbieber
Copy link
Member

dbieber commented Oct 31, 2018

Heads up some of the tests are failing in Python 3.6
E TypeError: unsupported operand type(s) for +: 'dict_keys' and 'dict_keys'
https://travis-ci.org/google/python-fire/jobs/448120104

@meshde
Copy link
Contributor Author

meshde commented Nov 4, 2018

Heads up some of the tests are failing in Python 3.6

Fixed them now. All tests passing!

@dbieber dbieber added the cla: yes Author has signed CLA label Feb 21, 2019
@dbieber
Copy link
Member

dbieber commented Feb 21, 2019

I apologize I messed up with the merge.

@dbieber
Copy link
Member

dbieber commented Feb 21, 2019

If you rebase 1024dda onto google/python-fire:master then I will squash and merge.

Edit: I did the first half of that (rebased 1024dda onto google/python-fire:master). Hope you don't mind me making those changes on your fork of the repo.

@dbieber dbieber force-pushed the master branch 2 times, most recently from 6c35e82 to 8bf2314 Compare February 21, 2019 21:52
@dbieber
Copy link
Member

dbieber commented Feb 21, 2019

merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Author has signed CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants