Skip to content

Conversation

@gspencergoog
Copy link
Contributor

@gspencergoog gspencergoog commented Jul 11, 2018

This uses @kevmoo's completion package to do command line completion for flutter, and a new command "bash-completion" (with alias "zsh-completion") that will output the necessary shell script setup code, and adds the hidden command "completion" that does the actual completion.

Because it adds a dependency, I also had to do flutter update-packages --force-upgrade.

Fixes #18988.

@gspencergoog gspencergoog requested a review from kevmoo July 11, 2018 02:48
@gspencergoog gspencergoog force-pushed the completion branch 2 times, most recently from 96852ab to f454e97 Compare July 11, 2018 03:48
@kevmoo
Copy link
Contributor

kevmoo commented Jul 11, 2018

I'm not a good person to review this. Thoughts, @Hixie ?

@kevmoo kevmoo removed their request for review July 11, 2018 20:35
@gspencergoog
Copy link
Contributor Author

OK, I really just wanted to make sure I was using your package the way it was intended.

@kevmoo
Copy link
Contributor

kevmoo commented Jul 11, 2018 via email

@gspencergoog
Copy link
Contributor Author

Yep, it works. The performance is "reasonable". I wouldn't call it fast, but it's definitely usable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description seems out of place here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, yeah, removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain the purpose of this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the CommandRunner from the args package calls argParser.parse(args) where this calls tryArgsCompletion(args, argParser). This is where the completion package hooks into things in order to interrogate the argParser and do its magic.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include a big comment that explains all this? Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already did...or are you saying it isn't big/explain-y enough?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I was reviewing an older copy of the PR.

@Hixie
Copy link
Contributor

Hixie commented Jul 12, 2018

tests?

@gspencergoog
Copy link
Contributor Author

Added the missing test file (forgot to git add).

Also, added support for specifying an output file instead of only writing to stdout.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/tracking/analytics recording/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, and fixed in config.dart too (where a similar comment was).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trivial nit: trailing comma and newline before )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@Hixie
Copy link
Contributor

Hixie commented Jul 12, 2018

LGTM

cc @tvolkert who may also have opinions

@flutter flutter deleted a comment from googlebot Jul 14, 2018
@gspencergoog gspencergoog merged commit 5d0d1b0 into flutter:master Jul 14, 2018
@gspencergoog gspencergoog deleted the completion branch July 14, 2018 04:24
teriyakijack added a commit to teriyakijack/flutter that referenced this pull request Jul 17, 2018
* flutter_master: (810 commits)
  Revert engine roll to 316b026
  roll engine to 316b026 (flutter#19419)
  Revert "enable lint unnecessary_const (flutter#19342)" (flutter#19423)
  enable lint unnecessary_const (flutter#19342)
  Chevrons in month picker are semi-transparent when the month is scrolled (flutter#19363)
  Revert "Use FlutterProject to locate files  (flutter#18913)" (flutter#19409)
  Extra debug information in run_release_test (flutter#19405)
  Fix typo (flutter#19402)
  Use FlutterProject to locate files  (flutter#18913)
  Revert "roll engine to 9af920e (flutter#19365)" (flutter#19376)
  roll engine to 9af920e (flutter#19365)
  increase cache size if image is loaded that is larger than max size (flutter#19352)
  Add Bash and Zsh command-line completion for flutter (flutter#19243)
  Support keyboardAppearance field for iOS (flutter#19244)
  Add option to silence driver extension errors (flutter#19247)
  Add HeroController to CupertinoApp (flutter#19326)
  have text finder convert Text.rich to plain text for comparison (flutter#19270)
  Correct contentPadding type in InputDecoration.debugFillProperties (flutter#19318)
  Revert "Revert "Use runTests in fuchsia tester. (flutter#19178)" (flutter#19321)" (flutter#19327)
  Roll engine to c5a63d (flutter#19288)
  ...
DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request Jul 19, 2018
This uses @kevmoo's completion package to do command line completion for flutter, and a new command "bash-completion" (with alias "zsh-completion") that will output the necessary shell script setup code, and adds the hidden command "completion" that does the actual completion.

Because it adds a dependency, I also had to do flutter update-packages --force-upgrade.

Fixes flutter#18988.
@Solido
Copy link
Contributor

Solido commented Sep 26, 2018

Is there any process to activate it ?
My Zsh cannot complete Flutter cmd.
Thanks

@gspencergoog
Copy link
Contributor Author

Yes, in the help for the bash-completion command, it gives instructions. Basically, you run it as so:

flutter bash-completion flutter_completion.sh

and it will write a completion setup script. You then source flutter_completion.sh in your shell startup (.zshrc for Zsh).

You might also place the flutter_completion.sh in a completion.d directory renamed as flutter if you have other completion scripts there already that are sourced automatically.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flutter bash completion

5 participants