cider icon indicating copy to clipboard operation
cider copied to clipboard

Customize banner

Open AndreaCrotti opened this issue 1 year ago • 8 comments

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

AndreaCrotti avatar Dec 19 '23 15:12 AndreaCrotti

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?

vemv avatar Dec 19 '23 15:12 vemv

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?

AndreaCrotti avatar Dec 19 '23 15:12 AndreaCrotti

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 avatar Dec 19 '23 16:12 bbatsov

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.

bbatsov avatar Dec 19 '23 16:12 bbatsov

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

vemv avatar Dec 19 '23 16:12 vemv

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.

bbatsov avatar Dec 19 '23 16:12 bbatsov

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

vemv avatar Dec 19 '23 16:12 vemv

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?

AndreaCrotti avatar Dec 20 '23 10:12 AndreaCrotti