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

feat: base completion for fastboot #8904

Merged
merged 3 commits into from
Apr 26, 2022
Merged

feat: base completion for fastboot #8904

merged 3 commits into from
Apr 26, 2022

Conversation

NextAlone
Copy link
Contributor

@NextAlone NextAlone commented Apr 22, 2022

Description

feat: base completion for fastboot according to its help

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.rst

__fish_complete_path
else
__fish_fastboot_list_partition
end
Copy link
Member

Choose a reason for hiding this comment

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

You loop over commandline -opc which includes the command itself (fastboot), which means the else-branch is taken at least once.
So how about moving the else-branch outside the loop?
Also, I don't know fastboot but I'd imagine a return after __fish_complete_path could make sense because why would we need two partitions on the commandline?


function __fish_fastboot_list_partition_and_file
for i in (commandline -opc)
if contains -- (string replace -r '_[ab]' '' $i) (__fish_fastboot_list_partition)
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious, why the _[ab]?

Copy link
Contributor Author

@NextAlone NextAlone Apr 26, 2022

Choose a reason for hiding this comment

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

In newer devices with A/B (Seamless) System Updates, that partitions are divided into foo_a and foo_b, for example, boot_a, boot_b. Then when boot_a or boot_b or boot (represent current slot) is typed, it represent the target patition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

@@ -0,0 +1,78 @@
function __fish_fastboot_no_subcommand -d 'Test if fastboot has yet to be given the subcommand'
for i in (commandline -opc)
if contains -- $i flashall getvar oem flashing reboot update erase format devices flash get_staged help stage boot fetch
Copy link
Member

Choose a reason for hiding this comment

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

I guess we could use __fish_seen_subcommand_from here

@NextAlone NextAlone requested a review from krobelus April 26, 2022 21:07
@krobelus krobelus merged commit 9ce09fb into fish-shell:master Apr 26, 2022
@krobelus krobelus added this to the fish 3.5.0 milestone Apr 26, 2022
@NextAlone NextAlone deleted the patch-fastboot branch May 14, 2022 16:50
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants