oh-my-fish / theme-budspencer

A theme for nerds, makes fish even more powerful. It's equipped with a hell of a lot of nice functions and key bindings to speed up your workflow.
MIT License
106 stars 42 forks source link

expr: syntax error #57

Closed MartinDelille closed 5 years ago

MartinDelille commented 5 years ago

Each time I type a type a fish command I have the following error:

$ fish --version
fish, version 3.0.0-172-g6d11e464
expr: syntax error
[: Missing argument at index 2
kinjoyuya commented 5 years ago

same error orz

kinjoyuya commented 5 years ago
fish, version 3.0.2
expr: syntax error
[: Missing argument at index 2
kinjoyuya commented 5 years ago

then, i tried to uninstall fish...

error message is here

Uninstalling /usr/local/Cellar/fish/3.0.2... (953 files, 8.3MB)
fish: Unknown command fish_indent
~/.config/fish/functions/fish_prompt.fish (line 1): 
echo $history[1] | fish_indent | expand -t 4
                   ^
in command substitution
    called on line 527 of file ~/.config/fish/functions/fish_prompt.fish

in function '__budspencer_create_cmd_hist'
    called on standard input

in event handler: handler for generic event 'fish_prompt'

set: You provided 1 indexes but 0 values
expr: syntax error
contains: Key not specified
expr: syntax error
[: Missing argument at index 2

syntax error ... orz

clayauld commented 5 years ago

Looks like you're using Homebrew on MacOS. I'm not getting that issue at all on my installation. Can you update your omf installation to see if a fix has been pushed already?

clayauld commented 5 years ago

I noticed the error only occurs when the shell is running inside a git repo. I'm seeing the issue now.

phoenisx commented 5 years ago

This issue is not resolved, still getting an error message inside git repo @clayauld .

error-msg-budspencer
clayauld commented 5 years ago

What version of expr and sed are you using? There are known issues with the versions included in MacOS. If you do not have the versions installed from Homebrew try that. More info can be found in the Readme about this.

MartinDelille commented 5 years ago

I'm also still having the issue. I don't know how to get the version of expr and sed but I'm using the one from MacOS Mojave:

$ which expr
/bin/expr
$ which sed
/usr/bin/sed
phoenisx commented 5 years ago

Yeah @clayauld It got fixed, once I changed to GNU tools. For other's ref, do the following:

brew install coreutils gnu-sed

Above command installs g prefixed commands for their MacOS alternates.

To fix that, add this to your ~/.config/fish/config.fish:

if test (uname -s) = "Darwin"
  set -gx PATH /usr/local/opt/coreutils/libexec/gnubin $PATH
  set -gx PATH /usr/local/opt/gnu-sed/libexec/gnubin $PATH
end
MartinDelille commented 5 years ago

I followed your advice and now have the following:

$ which expr
/usr/local/opt/coreutils/libexec/gnubin/expr
$ which sed
/usr/local/opt/gnu-sed/libexec/gnubin/sed

Unfortunately, when installing theme-budspencer, I still have this error message:

$ ls
~/.config/fish/functions/fish_prompt.fish (line 681): switch: Expected exactly one argument, got 0

  switch $pwd_style
         ^
in function '__budspencer_prompt_bindmode'
    called on line 884 of file ~/.config/fish/functions/fish_prompt.fish

in command substitution
    called on line 1768 of file ~/.config/fish/functions/fish_prompt.fish

in function 'fish_prompt'
    called on standard input

in command substitution
    called on standard input

~/.config/fish/functions/fish_prompt.fish (line 647): switch: Expected exactly one argument, got 0

    switch $pwd_style
           ^
in function '__budspencer_prompt_git_branch'
    called on line 884 of file ~/.config/fish/functions/fish_prompt.fish

in command substitution
    called on line 1768 of file ~/.config/fish/functions/fish_prompt.fish

in function 'fish_prompt'
    called on standard input

in command substitution
    called on standard input

~/.config/fish/functions/fish_prompt.fish (line 807): switch: Expected exactly one argument, got 0

    switch $pwd_style
           ^
in function '__budspencer_prompt_left_symbols'
    called on line 884 of file ~/.config/fish/functions/fish_prompt.fish

in command substitution
    called on line 1768 of file ~/.config/fish/functions/fish_prompt.fish

in function 'fish_prompt'
    called on standard input

in command substitution
    called on standard input

~/.config/fish/functions/fish_right_prompt.fish (line 143): switch: Expected exactly one argument, got 0

    switch $pwd_style
           ^
in function '__budspencer_prompt_git_symbols'
    called on line 266 of file ~/.config/fish/functions/fish_right_prompt.fish

in command substitution
    called on line 531 of file ~/.config/fish/functions/fish_right_prompt.fish

in function 'fish_right_prompt'
    called on standard input

in command substitution
    called on standard input

~/.config/fish/functions/fish_right_prompt.fish (line 248): switch: Expected exactly one argument, got 0

    switch $pwd_style
           ^
in function '__budspencer_prompt_pwd'
    called on line 266 of file ~/.config/fish/functions/fish_right_prompt.fish

in command substitution
    called on line 531 of file ~/.config/fish/functions/fish_right_prompt.fish

in function 'fish_right_prompt'
    called on standard input

in command substitution
    called on standard input

It seems to be related to #46

clayauld commented 5 years ago

after installing the theme please run exec fish. According to #46 starting a new session fixed his issue.