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

Customize banner #3599

Open
AndreaCrotti opened this issue Dec 19, 2023 · 8 comments
Open

Customize banner #3599

AndreaCrotti opened this issue Dec 19, 2023 · 8 comments

Comments

@AndreaCrotti
Copy link

When repling into live systems, it would be nice to make it clear that you are not connected to your local system.
Currently there is just a boolean cider-repl-display-help-banner but the actual banner is hard coded and not customizable.

Ideally, the banner could be:

  • customizable
  • maybe even passed as argument since it might change even in the same project (if you connect to dev/prod)
  • maybe even computed by a custom function? If the host/port is enough to know what banner you want for example
@vemv vemv transferred this issue from clojure-emacs/cider-nrepl Dec 19, 2023
@vemv
Copy link
Member

vemv commented Dec 19, 2023

Sounds reasonable to me!

maybe even computed by a custom function?

Did you mean that users would pass a lambda (host port) and that CIDER would invoke it adequately?

@AndreaCrotti
Copy link
Author

Sounds reasonable to me!

maybe even computed by a custom function?

Did you mean that users would pass a lambda (host port) and that CIDER would invoke it adequately?

Yeah that would be an option. It might be generic enough to support all the use cases maybe?

@bbatsov
Copy link
Member

bbatsov commented Dec 19, 2023

maybe even computed by a custom function? If the host/port is enough to know what banner you want for example

I think that making this a customizable function would be best. I don't think the first line of the message is part of the help banner, so we probably don't even need the host/port params.

@bbatsov
Copy link
Member

bbatsov commented Dec 19, 2023

I'm thinking it might actually be better to introduce some optional user banner function that takes every useful param we can think of and substitutes the help banner when present (or appears after it), given that the help banner is just static text. Something along those lines.

@vemv
Copy link
Member

vemv commented Dec 19, 2023

Indeed. The fn could take a single nrepl-dict as a param, so that it can grow without breaking changes?

@bbatsov
Copy link
Member

bbatsov commented Dec 19, 2023

Why a dict? It can just be some standard alist or a plist, as I doubt this data will have anything to do with nREPL messages which the dicts were created to model.

@vemv
Copy link
Member

vemv commented Dec 19, 2023

It's simply a nice / commonly used 'API', but no strong preference from my side.

@AndreaCrotti
Copy link
Author

AndreaCrotti commented Dec 20, 2023

Maybe not exactly related, but I also saw that you can pass a custom greeting-fn function to nrepl/start-server.
You'll definitely have all the information you need (to distinguish staging/prod for example) on the server side, and maybe I can also use that to let users know where they are connected to?

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

No branches or pull requests

3 participants