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

mount & udisksctl: improve `-o` completions` #3764

Merged
merged 2 commits into from Feb 12, 2017
Merged

Conversation

@moverest
Copy link
Contributor

moverest commented Jan 22, 2017

Aside from completing new options, it also completes uid and gid options with users and groups ids.

Exemple:

> mount -o ro,uid=<tab>

Will complete with user ids.

Copy link
Member

faho left a comment

  • Indent
  • Remove "$opt,"
  • command -sq
@@ -0,0 +1,174 @@
function __fish_print_user_ids
if test -x /usr/bin/getent

This comment has been minimized.

Copy link
@faho

faho Jan 25, 2017

Member

command -sq getent. We shouldn't care if it's in /usr/bin.

for opt in $fish_mount_opts
printf '%s\n' $prefix$opt

if not string match '*=*' $opt ^/dev/null >/dev/null

This comment has been minimized.

Copy link
@faho

faho Jan 25, 2017

Member

string match has a "-q"/"--quiet" option to silence output. Also you'll want to separate options from arguments with "--" - string match -q '*=*' -- $opt.

end

function __fish_complete_mount_opts
set -l fish_mount_opts\

This comment has been minimized.

Copy link
@faho

faho Jan 25, 2017

Member

Indentation is annoying on these following lines. Please run this through fish_indent.

Any weirdness that is left then is fish_indent's fault so that should be improved.

This comment has been minimized.

Copy link
@moverest

moverest Jan 25, 2017

Author Contributor

My memory is probably playing tricks on me, but I think the formating here is from fish_indent. Anyway, I'll check that tomorrow and make the other changes to the PR as well.

This comment has been minimized.

Copy link
@moverest

moverest Jan 26, 2017

Author Contributor

So, I've ran fish_indent, and it does remove any indentation here. :-/

printf '%s\n' $prefix$opt

if not string match '*=*' $opt ^/dev/null >/dev/null
if string match -r '\t' $opt ^/dev/null >/dev/null

This comment has been minimized.

Copy link
@faho

faho Jan 25, 2017

Member

Please remove this part. This has the effect of printing every option twice, once with a trailing comma and once without.

The trailing comma sounds nice until you realize that selecting it leaves you a space after it, so now you need to go back and either remove the comma or continue.

This comment has been minimized.

Copy link
@moverest

moverest Jan 25, 2017

Author Contributor

So I guess there is no way to prevent fish from adding the space?

@faho faho added this to the next-minor milestone Jan 25, 2017
set -l last_arg $args[-1]
set -e args[-1]

switch (string replace -r '=.*' '=' -- $last_arg)

This comment has been minimized.

Copy link
@moverest

moverest Jan 26, 2017

Author Contributor

Fix: I've added the string replace here because it wouldn't complete if we add anything after the = (e.g. uid=1<tab> wouldn't show anything).

@faho faho merged commit cbea0b9 into fish-shell:master Feb 12, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@faho
Copy link
Member

faho commented Feb 12, 2017

Merged, thanks!

develop7 added a commit to develop7/fish-shell that referenced this pull request Apr 17, 2017
* mount & udisksctl: improve `-o` completions`

* Update __fish_complete_mount_opts
@moverest moverest deleted the moverest:mount-opts branch Jun 9, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.