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

Checking for new version fails #233

Closed
filipebarros opened this issue Nov 19, 2020 · 12 comments · Fixed by #237
Closed

Checking for new version fails #233

filipebarros opened this issue Nov 19, 2020 · 12 comments · Fixed by #237
Labels
🐛 bug something that doesn't works as expected

Comments

@filipebarros
Copy link
Contributor

After upgrading to the latest version and setting pure_check_for_new_release to true, when I run exec fish or start I get the following error:

Checking for new release…
test: Missing argument at index 2

~/.config/fish/functions/_pure_check_for_new_release.fish (line 8):
        if test $pure_version != $latest
           ^
in function '_pure_check_for_new_release'
	called on line 2 of file ~/.config/fish/functions/fish_greeting.fish
in function 'fish_greeting'
	called on line 126 of file /usr/local/Cellar/fish/3.1.2/share/fish/functions/__fish_config_interactive.fish
in function '__fish_config_interactive'
	called on line 170 of file /usr/local/Cellar/fish/3.1.2/share/fish/config.fish
in function '__fish_on_interactive'
in event handler: handler for generic event 'fish_prompt'

Env

Pure

2.7.0

Fish

3.1.2

OS/distribution

macOS Catalina 10.15.7
@edouard-lopez edouard-lopez added the 🐛 bug something that doesn't works as expected label Nov 20, 2020
@edouard-lopez
Copy link
Member

Did you set it using the command line like I demonstrated in the release note?CCould you check your pure config in ~/.config/fish/conf.d/pure.fish?

CI is in bad shape at the moment, Travis builds are extremely slow to start, so merge without it ☹️.
I need to switch to github CI to get a better feedback loop. I will do my best to look at the the issue over the weekend

@filipebarros
Copy link
Contributor Author

I changed the pure_check_for_new_release in ~/.config/fish/fish_variables to true.

I tried to do it like in the release notes:
set --global pure_check_for_new_release true and running exec fish again, and I get the same error. For the time being I just reverted it back to false.

Thanks

@edouard-lopez
Copy link
Member

@filipebarros how did you install? Could you try the manual install command:

# Download the installer to `/tmp`
curl git.io/pure-fish --output /tmp/pure_installer.fish --location --silent
# Source and trigger the installer
source /tmp/pure_installer.fish; and install_pure

@edouard-lopez
Copy link
Member

edouard-lopez commented Nov 26, 2020

related: #153 #138


I reckon the variable toggle isn't taken into account due to this constrain:
https://github.com/rafaelrinaldi/pure/blob/55bef050159bc9d56d62fb9362d9b6f4e05ec526/tests/_pure_set_default.test.fish#L16

Try the following:

# installation
fisher install rafaelrinaldi/pure
# configuration
sed -i 's/_pure_set_default pure_check_for_new_release false/_pure_set_default pure_check_for_new_release true/' ~/.config/fish/conf.d/pure.fish
# allow variable reassignment
set --erase pure_check_for_new_release
# read config to enable feature
exec fish

@filipebarros
Copy link
Contributor Author

@edouard-lopez I tried that but nothing changed: I replaced _pure_set_default pure_check_for_new_release true to _pure_set_default pure_check_for_new_release false, ran the erase command and then ran exec fish but I still get the same error.

@edouard-lopez
Copy link
Member

edouard-lopez commented Nov 26, 2020

I only manage to get the same error when I edit ~/.config/fish/conf.d/pure.fish to comment the variable out

#_pure_set_default pure_check_for_new_release false

and pure_check_for_new_release is not set which is show by set --query … outputing 1

set --query pure_check_for_new_release ; echo $status
1

If that's the case you should be able to test the feature by giving ita universal scope:

set --universal pure_check_for_new_release true
exec fish

If that's so, could you check ~/.config/fish/conf.d/pure.fish is correct and nothing is erasing the variable elsewhere?

@filipebarros
Copy link
Contributor Author

~/.config/fish/conf.d/pure.fish has the pure_check_for_new_release set to true and it is also true in ~/.config/fish/fish_variables (SETUVAR pure_check_for_new_release:true).

Running set --query pure_check_for_new_release ; echo $status outputs 0 for me.

Doing:

set --universal pure_check_for_new_release true
exec fish

has the same output as mentioned in my first comment.

@edouard-lopez
Copy link
Member

@filipebarros
Note that I [released new version]k(https://github.com/rafaelrinaldi/pure/releases).

So the feature flag seem correct, What do you get with

echo $pure_version

Could you add a breakpoint in the feature function in ~/.config/fish/functions/_pure_check_for_new_release.fish just before the if and see what's inside both variables latest and pure_version?

@filipebarros
Copy link
Contributor Author

filipebarros commented Nov 30, 2020

I didn't update to the latest version yet.

$pure_version is fine (2.7.0) but $latest is empty.

edit:

The curl works fine, the sed doesn't return anything. 🤔

edit2:

tried running the same in https://sed.js.org and it returns the version. maybe it has to do with the operating system?

@edouard-lopez
Copy link
Member

Can you give me some information about your sed? I will see if I can implement it purely with fish

@filipebarros
Copy link
Contributor Author

|> what /usr/bin/sed
/usr/bin/sed
	PROGRAM:sed  PROJECT:text_cmds-101.40.1

Not sure if this is of any help though (apparently sed on macOS doesn't "have" a version)

edouard-lopez added a commit that referenced this issue Dec 1, 2020
Fails is due to sed differences between Linux/MacOS,
so I replace with native fish code

fixes #233
edouard-lopez added a commit that referenced this issue Dec 1, 2020
Fails is due to sed differences between Linux/MacOS,
so I replace with native fish code

fixes #233
edouard-lopez added a commit that referenced this issue Dec 1, 2020
Fails is due to sed differences between Linux/MacOS,
so I replace with native fish code

fixes #233
@filipebarros
Copy link
Contributor Author

@edouard-lopez it is working now 👍 thanks

edouard-lopez added a commit that referenced this issue Aug 21, 2023
Fails is due to sed differences between Linux/MacOS,
so I replace with native fish code

fixes #233
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug something that doesn't works as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants