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

fish_config should have a text UI #3625

Closed
vbextreme opened this issue Dec 6, 2016 · 13 comments
Closed

fish_config should have a text UI #3625

vbextreme opened this issue Dec 6, 2016 · 13 comments

Comments

@vbextreme
Copy link

fish implements fish_config command that lets you view and select, but not editing, configurations.

It looks very cute, but to create a web server and then open a web browser to display the configurations seem a choice a little absurd.
I was expecting something more consistent as a classic ncurses menus, this would also permit to change configurations via tty, which is now unusable.

@krader1961 krader1961 added this to the fish-future milestone Dec 6, 2016
@krader1961
Copy link
Contributor

Patches are welcomed. It's a small project with just a handful of regular committers. So if someone like yourself, @vbextreme, are passionate about improving fish in some way we'd love to work with you to make that happen.

Since we already have a dependency on python, and have no plans to remove that dependency, the natural place to implement this capability is in the share/tools/web_config/webconfig.py program (or a fork of it). Then modify the fish_config function to include a flag to select text versus web UIs.

@vbextreme
Copy link
Author

thanks for the information.
I hope to recover a bit 'of time to add the new functionality.

@krader1961 krader1961 changed the title inconsistent fish_config fish_config should have a text UI Dec 6, 2016
@silverhook
Copy link

I have the same issue as @vbextreme – running Fish on a server.

What I think would be already useful enough is if fish_config would produce an HTML page that can actually be used in a CLI web browser – whether that be lynx, elinks or w3m.

@silverhook
Copy link

A different solution to the same problem is also being discussed in bug #1916.

@krader1961
Copy link
Contributor

I predict issue #1916 won't be implemented anytime soon. Security is hard. Also, having a curses based solution has the advantage that it's running inside your terminal so accurately displaying colors, especially how they look given the terminals background color, becomes trivial. Personally I wish the person who implemented the web UI had instead spent the time creating a curses based UI.

@silverhook
Copy link

Personally I wish the person who implemented the web UI had instead spent the time creating a curses based UI.

Personally, I agree.

But I see how having docs and settings in browser does make it more appealing to the modern-day crowd, so I don’t see it going away any time soon.

Having a good ncurses option for fish_config does seem like a sterling idea though.

A(n interim) lighter idea still might be to just have a CLI command to select (maybe even preview) prompts.

@faho
Copy link
Member

faho commented Dec 17, 2016

A(n interim) lighter idea still might be to just have a CLI command to select (maybe even preview) prompts.

I've actually tried to do something like that. It'd be used like prompt view sorin. I kinda feel like this CLI feels a bit better than some dialog-like ncurses thing would.

One issue there is doing it without any accidental side-effects - you don't want previewing a prompt to change any variable in your running shell. That's easy enough to do for ours - we only set local or global variables, so just running it in a new fish process works.

In future I'd like to extend this to a "prompts" directory so you can add to the samples, that would make it a bit trickier (though you'd need to "audit" them anyway, since these files can contain arbitrary code).

There's also the issue of supporting a set of both left and right prompts - one possible solution is to use one directory per sample "theme", so we'd have a "sorin/" directory with a "fish_prompt.fish" and a "fish_right_prompt.fish" file. This is also more easily extendable to other functions (like "fish_greeting" and "fish_mode_prompt"), and would even allow using e.g. git-submodule.

@silverhook
Copy link

One issue there is doing it without any accidental side-effects - you don't want previewing a prompt to change any variable in your running shell. That's easy enough to do for ours - we only set local or global variables, so just running it in a new fish process works.

You could simply start a new fish shell with the previewed prompt and then immediately quit it. Perhaps an additional flag to switch between a simple preview (new shell, that quits automatically) and a testing environment (new shell, with a start message that you should simply quit/logout/Ctrl+D when you’re done playing around) would make sense.

There's also the issue of supporting a set of both left and right prompts […]

I don’t follow how this is an issue, nor where the sorin/ folder comes from. Can you please elaborate?

@faho
Copy link
Member

faho commented Dec 17, 2016

You could simply start a new fish shell with the previewed prompt and then immediately quit it.

That's just what I did.

I don’t follow how this is an issue, nor where the sorin/ folder comes from. Can you please elaborate?

The "sorin" prompt contains both a fish_prompt and a fish_right_prompt function. We currently don't save the right_prompt even in fish_config.

Though I explained that wrong (coffee hadn't taken effect yet, I guess) - the issue isn't with those two functions since we can just handle them, the issue is actually with arbitrary helper functions and code outside of any function (e.g to set cached variables). Though we could just copy the entire file to fish_prompt.fish (which wouldn't be as clean as I'd like).

Anyway, all that stuff is also an issue with fish_config, so we can also handle it later.

I'll play around with this a bit more to figure out what it should be able to do and how it should work when setting a prompt.

@silverhook
Copy link

You could simply start a new fish shell with the previewed prompt and then immediately quit it.

That's just what I did.

Hehe, tea hasn’t kicked in here yet either 😸 🍵

The "sorin" prompt contains both a fish_prompt and a fish_right_prompt function. We currently don't save the right_prompt even in fish_config.
[…]
Anyway, all that stuff is also an issue with fish_config, so we can also handle it later.

That makes sense.

I think if a CLI command for the normal/left-hand prompt can be implemented, that would already be of great help for most users who don’t use a DE/WM.

Later we can extend it to also manage the right-hand prompt and seeing as this is an issue also with fish_config, that might make sense to be solved on the level of theme “packages”.

I'll play around with this a bit more to figure out what it should be able to do and how it should work when setting a prompt.

You rock! I’m happy to test it, if you have anything public yet.

@markkuit
Copy link

markkuit commented Dec 10, 2017

Are there no further updates on this matter?

@faho
Copy link
Member

faho commented Dec 10, 2017

Nope. I haven't been working on this. I'm reasonably certain what would roughly be required:

  • The prompts would need to move out of the web_config directory

  • They'd have to move into one directory per prompt (so the sorin prompt gets prompts/sorin to itself), with each function into its own file

  • fish_config would have to be adjusted for that

  • A fish_cli_config utility would start a new fish instance that sources that directory

If anyone wants to pick it up, feel free to do so! I haven't had as much time to work on fish as I'd like.

faho added a commit to faho/fish-shell that referenced this issue Apr 27, 2021
It's a bit weird to *have* to fire up a browser to get fish_config to
choose a prompt.

So this adds `prompt`:

- `prompt list` shows all the available prompt names
- `prompt show` demos the available sample prompts
- `prompt choose` sources a prompt
- `prompt save` makes the choice permanent

Part of fish-shell#3625.

TODO: This does not currently show the right prompt, which is awkward
to do because we'd have to move it to the right.
faho added a commit to faho/fish-shell that referenced this issue Apr 27, 2021
It's a bit weird to *have* to fire up a browser to get fish_config to
choose a prompt.

So this adds `prompt`:

- `prompt list` shows all the available prompt names
- `prompt show` demos the available sample prompts
- `prompt choose` sources a prompt
- `prompt save` makes the choice permanent

Part of fish-shell#3625.

TODO: This does not currently show the right prompt, which is awkward
to do because we'd have to move it to the right.
@faho faho mentioned this issue Apr 27, 2021
5 tasks
faho added a commit to faho/fish-shell that referenced this issue May 1, 2021
It's a bit weird to *have* to fire up a browser to get fish_config to
choose a prompt.

So this adds `prompt`:

- `prompt list` shows all the available prompt names
- `prompt show` demos the available sample prompts
- `prompt choose` sources a prompt
- `prompt save` makes the choice permanent

Part of fish-shell#3625.

TODO: This does not currently show the right prompt, which is awkward
to do because we'd have to move it to the right.
faho added a commit to faho/fish-shell that referenced this issue May 1, 2021
It's a bit weird to *have* to fire up a browser to get fish_config to
choose a prompt.

So this adds `prompt`:

- `prompt list` shows all the available prompt names
- `prompt show` demos the available sample prompts
- `prompt choose` sources a prompt
- `prompt save` makes the choice permanent

Part of fish-shell#3625.

TODO: This does not currently show the right prompt, which is awkward
to do because we'd have to move it to the right.
faho added a commit to faho/fish-shell that referenced this issue May 1, 2021
It's a bit weird to *have* to fire up a browser to get fish_config to
choose a prompt.

So this adds a `prompt` subcommand to `fish_config`:

- `fish_config prompt list` shows all the available prompt names
- `fish_config prompt show` demos the available sample prompts
- `fish_config prompt choose` sources a prompt
- `fish_config prompt save` makes the choice permanent

A bare `fish_config` or `fish_config browse` opens the web UI.

Part of fish-shell#3625.

TODO: This shows the right prompt on a new line. Showing it in-line is awkward
to do because we'd have to move it to the right.
faho added a commit that referenced this issue May 1, 2021
It's a bit weird to *have* to fire up a browser to get fish_config to
choose a prompt.

So this adds a `prompt` subcommand to `fish_config`:

- `fish_config prompt list` shows all the available prompt names
- `fish_config prompt show` demos the available sample prompts
- `fish_config prompt choose` sources a prompt
- `fish_config prompt save` makes the choice permanent

A bare `fish_config` or `fish_config browse` opens the web UI.

Part of #3625.

TODO: This shows the right prompt on a new line. Showing it in-line is awkward
to do because we'd have to move it to the right.
@faho
Copy link
Member

faho commented Jul 15, 2021

Okay, with #8132 (themes) and #7958 (prompts) done and providing a CLI to select these things, I'm closing this.

The rest is already available - you can alter history with history, modify functions with funced, change abbreviations with abbr, bindings with bind and set variables with set. There is now nothing the web config tool can do that you can't do in the shell itself.

@faho faho closed this as completed Jul 15, 2021
@faho faho modified the milestones: fish-future, fish 3.4.0 Jul 15, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants