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

Conversation

Projects
None yet
2 participants
@moverest
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.

@faho
  • Indent
  • Remove "$opt,"
  • command -sq
Show outdated Hide outdated share/functions/__fish_complete_mount_opts.fish
@@ -0,0 +1,174 @@
function __fish_print_user_ids
if test -x /usr/bin/getent

This comment has been minimized.

@faho

faho Jan 25, 2017

Member

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

@faho

faho Jan 25, 2017

Member

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

Show outdated Hide outdated share/functions/__fish_complete_mount_opts.fish
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.

@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.

@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.

@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.

@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.

@moverest

moverest Jan 25, 2017

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.

@moverest

moverest Jan 25, 2017

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.

@moverest

moverest Jan 26, 2017

Contributor

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

@moverest

moverest Jan 26, 2017

Contributor

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

Show outdated Hide outdated share/functions/__fish_complete_mount_opts.fish
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.

@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.

@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.

@moverest

moverest Jan 25, 2017

Contributor

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

@moverest

moverest Jan 25, 2017

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.

@moverest

moverest Jan 26, 2017

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).

@moverest

moverest Jan 26, 2017

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

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@faho

This comment has been minimized.

Show comment
Hide comment
@faho

faho Feb 12, 2017

Member

Merged, thanks!

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` (#3764)
* mount & udisksctl: improve `-o` completions`

* Update __fish_complete_mount_opts

@moverest moverest deleted the moverest:mount-opts branch Jun 9, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment