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 for set - _: command not found #6069

Closed
sullyj3 opened this issue Aug 26, 2019 · 4 comments
Closed

Completion for set - _: command not found #6069

sullyj3 opened this issue Aug 26, 2019 · 4 comments
Labels

Comments

@sullyj3
Copy link

sullyj3 commented Aug 26, 2019

Version: 2.7.1
OS: WSL
Terminal: wsltty (echo $TERM says xterm)

To preface, I can't repro this using the clean fish command sh -c 'env HOME=$(mktemp -d) fish', so presumably it's something to do with my config, however I'm unsure of how to begin to debug. Let me know if there are specific config files I should post.

Steps to reproduce with my config:

  1. Open new shell
  2. type set -Ux
  3. type any letter to trigger completion. Throws the following error message:

_: command not found 11:36
/usr/share/fish/completions/set.fish (line 1):
_ "Locale"
^
in command substitution
called on line -1 of file /usr/share/fish/completions/set.fish

from sourcing file /usr/share/fish/completions/set.fish
called on standard input

in command substitution
called on standard input

complete: Expected argument for option -d
/usr/share/fish/completions/set.fish (line 79):
complete -c set -n '_fish_set_is_locale' -x -a '(locale -a)' -d ( "Locale")
^
from sourcing file /usr/share/fish/completions/set.fish
called on standard input

in command substitution
called on standard input

   completecomplete - edit command specific tab-completions
    -

Synopsis
complete ( -c | --command | -p | --path ) COMMAND
[( -c | --command | -p | --path ) COMMAND]...
[( -e | --erase )]
[( -s | --short-option ) SHORT_OPTION]...
[( -l | --long-option | -o | --old-option ) LONG_OPTION]...
[( -a | --arguments ) OPTION_ARGUMENTS]
[( -f | --no-files )]
[( -r | --require-parameter )]
[( -x | --exclusive )]
[( -w | --wraps ) WRAPPED_COMMAND]...
[( -n | --condition ) CONDITION]
[( -d | --description ) DESCRIPTION]
complete ( -C[STRING] | --do-complete[=STRING] )

complete: Type “help complete” for related documentation

@krobelus
Copy link
Member

What is the output of type _? it should be something like

# Defined in /path/to/fish-shell/share/functions/_.fish @ line 5
function _ --description 'Alias for the gettext command'
    command gettext fish $argv
end

Perhaps you overwrote _ by creating ~/.config/fish/functions/_.fish.
Otherwise you could try to comment lines in your config until the error goes away (files ~/.config/fish/config.fish and ~/.config/fish/conf.d/*)

@sullyj3
Copy link
Author

sullyj3 commented Aug 28, 2019

I had _ aliased to sudo. I've removed the alias, and it seems to have fixed the issue. Was there a way to have this alias without causing problems?

@sullyj3 sullyj3 closed this as completed Aug 28, 2019
@krobelus
Copy link
Member

I had _ aliased to sudo. I've removed the alias, and it seems to have fixed the issue. Was there a way to have this alias without causing problems?

Not really, but it would be possible if instead of _, we internally used gettext (or a private wrapper starting with __).
E.g. find -name '*.fish' | xargs sed -i 's/( \?_\b/(gettext/g'
Would be easy to implement but I'm not sure if it's the best option, since _ seems to be more convenient for all those completions.

Another idea would be to issue a warning when user overrides a function provided by fish (or a builtin for that matter). This will prevent similar issues.

@zanchey
Copy link
Member

zanchey commented Sep 3, 2019

Another idea would be to issue a warning when user overrides a function provided by fish (or a builtin for that matter). This will prevent similar issues.

See #3000, where we went around a great deal regarding builtins. The problem with functions is that you then need a way to override the blacklist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants