pure-fish / pure

Pretty, minimal, and fast prompt for Fish shell inspired by sindresorhus/pure
https://pure-fish.github.io/pure/
MIT License
1.2k stars 131 forks source link

Remove `fish_greeting.fish` from this prompt #175

Open neon64 opened 5 years ago

neon64 commented 5 years ago

Installing this prompt overrides my own fish_greeting.fish file. While I understand its nice to get rid of the default fish greeting, shouldn't that be the responsibility of the user or a separate plugin, and not the responsibility of a prompt?

In other words, I feel it should be possible to mix and match prompts and greetings, rather than one controlling the other.

On another note: thanks very much for this prompt - I particularly like how the arrow direction switches with fish's vim mode - that's much more subtle than any mode indicator I had devised!

edouard-lopez commented 5 years ago

Hello @neon64, thanks for the feedback.

Was you fish_greeting.fish located in $HOME/.config/fish/functions/fish_greeting.fish? That's where installer place our fish_greeting.fish file, its the recommended way to leverage autoload mechanism.

Solution

You can either remove $HOME/.config/fish/functions/fish_greeting.fish and fallback to your setup or copy your setup in it.

Discussion

I understand your point about responsability but pure vision is to provide a clean and pure experience of the prompt. So, removing greeting and other presets sounds in line with this.

However, one is free to customize upon it as described above.

Cheers!

wilfredjonathanjames commented 1 year ago

Bumping.

Why is pure the plugin that gets to overwrite the fish_greeting.fish? What if other plugins want to do the same?

You're overwriting it because you want to check for updates, but shouldn't that be up to the user? Most fish users would be happy to update their greeting to add that feature.

Every time I run my fisher installer, this plugin wipes out my greeting. You're not really leaving much room for other people to customise fish.

edouard-lopez commented 1 year ago

Thanks for the feedback, do you think I can automate the addition of the call?

wilfredjonathanjames commented 1 year ago

I would definitely consider adding it to the README as an option to add to config.fish - I personally wouldn't add it. I like to update my plugins manually.

jorgebucaran commented 1 year ago

Here's an alternative. Instead of shipping an empty fish_greeting function, Pure could just set -U fish_greeting "" after install. This will suppress Fish's default greeting (in line with @edouard-lopez's line of thought) without wiping out an existing user's custom fish_greeting function. 🤓

edouard-lopez commented 1 year ago

Current Behaviour

Currently, on new session, pure checks for new release and show command to install, as we override the fish_greeting.fish file.

Proposed Behaviour

:warning: Introduce a breaking change in pure's behaviour that will require user action.

Does that sound right, to you?

wilfredjonathanjames commented 1 year ago

@edouard-lopez that sounds right to me. You could also follow the pattern of extending the file if it exists, or the config.fish, or provide instructions to stdout on install as you sometimes see with apt/brew

jorgebucaran commented 1 year ago

Suppress Fish's default greeting, as suggested by @jorgebucaran

There are various ways one may accomplish this. I would define an install event handler in conf.d/pure.fish like so:

function _pure_install --on-event pure_install
    set -U fish_greeting ""
end
edouard-lopez commented 1 year ago

You could also follow the pattern of extending the file if it exists,

How would you do that programmatically?

provide instructions to stdout on install

That's a good idea!

wilfredjonathanjames commented 1 year ago

Just bumped into this again. @edouard-lopez I agree option 2 is cleaner. Would you like to do it or do you want me to have a go? If you point me to the piece of code that does the overwrite I can take a shot.

edouard-lopez commented 1 year ago

@jorgebucaran I defined a custom fish_greeting function in the project. I believe @wjagodfrey own file is being overwritten during install. Emptying fish_greeting variable won't resolve the issue when people have added a custom fish_greeting function.

However, we can:

  1. rename the project's fish_greeting.fish to _pure_fish_greeting.fish so it doesn't override user file ;
  2. add a post_install event handler that check the situation so that:

    • when fish_greeting.fish is missing, use our (i.e. rename _pure_fish_greeting.fish as fish_greeting.fish) ;
    • when fish_greeting.fish already exists, output instruction to add call to _pure_check_for_new_release:

      echo "_pure_check_for_new_release" >> $fish_function_path/fish_greeting.fish

@wjagodfrey I'm open to PR, here are some entry points:

The project has a docker container you can use (cf. makefile)

jorgebucaran commented 1 year ago

My suggestion is to simply remove fish_greeting.fish and use the install event exactly as I suggested in https://github.com/pure-fish/pure/issues/175#issuecomment-1264525058. That's all you need to do.