-
-
Notifications
You must be signed in to change notification settings - Fork 105
Description
Problem
We're going to be creating a few sibling Clojure projects for work. I'm setting up a small library we can reuse that provides a suped-up-repl experience combining nREPL, REBL, Rebel-Readline, and some middleware I am confident we'll always need\want to be productive.
To achieve some of the autonomy desired, I have to implement something like the cmdline file to setup the nREPL server and automatically start other services.
The problem is that that -run function looks particular meaty to me. It parses arguments, starts the repl server, prints help info, prints the start message, writes the port file, and a few other beneficial behaviors that make nREPL a dream to use that can't be reused.
https://github.com/nrepl/nrepl/blob/0.5.3/src/clojure/nrepl/cmdline.clj#L240
Solution
Could we split up that behavior into several functions? This way others can create more advanced REPLs while incorporating the features we love from stock nREPL.
I'm happy to submit a PR to split the behaviors up myself but to summarize what I'm thinking:
- Create a function for parsing the arguments
- Create a function for directing the parsed arguments into specific behaviors
Create a function for starting the server(already exists)- Create a function for printing the parseable header
- Create a function for printing the current Clojure version and current user info
Value
- Allow users to develop richer REPL experiences using nREPL's cmdline functions as base
- More beginner friendly options can be more readily available
Alternatives
- Using snippets from cmdline I can get the functionality I want, but I am duplicating some code
- Interested in recommended alternatives if a better means to accomplish this exists
Notes
I'm by no means a Clojure expert so there may be very good reasons for the cmdline.-run function to be as meaty as it is be it performance or other reasons unknown to me at this time. From my perspective however, I think we can make that function a bit more idiomatic with a bit of time to get a lot more from it.
I am interested in your thoughts on this as I want to know if creating a PR for this is worth your time.