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

New task: bare-repl #582

Merged
merged 1 commit into from
Jul 11, 2017
Merged

Conversation

pesterhazy
Copy link
Contributor

@pesterhazy pesterhazy commented Feb 6, 2017

This PR adds a new bare-repl task to start a "bare" or terminal repl, as per clojure.main/repl.

A bare repl has a few advantages over the nREPL-based boot repl setup:

  • fewer moving parts (no pods, no network connection)
  • much faster startup
  • direct access to tty, i.e. this works with boot repl -B but not with boot repl: (.readPassword (System/console) "Password: " (object-array []))

Like the normal repl task when not invoked with the -s option, boot bare-repl blocks the boot pipeline until the repl is closed with ^D.

Essentially the bare REPL is closer to what you get when following Clojure's Getting Started guide. Disadvantages of boot bare-repl compared to boot repl include:

  • no pretty exceptions
  • no readline support (but rlwrap boot repl -B works well)

@@ -58,3 +58,8 @@
[{:keys [bind port init-ns middleware handler] :as options}]
(let [opts (->> options setup-nrepl-env!)]
(@start-server opts)))

(defn launch-bare-repl
[opts]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(defn launch-bare-repl
[opts]
(require 'clojure.main)
((resolve 'clojure.main/repl)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably you have forgotten to pass the options here.

@alandipert
Copy link
Contributor

This looks juicy but doesn't merge quickly, can you please give it a look when you have a chance? Thanks 🥇

@Deraen
Copy link
Contributor

Deraen commented Mar 3, 2017

I wonder if this should be completely different task as the options probably differ heavily from nrepl options?

@alandipert
Copy link
Contributor

alandipert commented Mar 3, 2017 via email

@pesterhazy pesterhazy force-pushed the feature/bare-repl branch 5 times, most recently from 26e3750 to f230f5d Compare March 28, 2017 16:12
@pesterhazy pesterhazy changed the title Repl task: add bare terminal repl option Add bare-repl task Mar 28, 2017
@pesterhazy
Copy link
Contributor Author

Based on the feedback by @Deraen et al, I've rebased on master and extracted a standalone task, bare-repl. It accepts only the --init, --init-ns and --eval options. What do you think @alandipert?

@pesterhazy pesterhazy changed the title Add bare-repl task New task: bare-repl Mar 28, 2017
@alandipert
Copy link
Contributor

💯 - Can you please add to CHANGES.md for this one too?

@pesterhazy
Copy link
Contributor Author

@alandipert done

@arichiardi
Copy link
Contributor

Sorry if this come out it the blue but these has been a lot of discussion around repls in #unrepl lately and I was thinking that this task could be named socket only . The default is to use the accept function that launches the repl but then an option can specify a symbol containing any accept function. We would mimic Clojure's behavior and make thing way more extensible: we have pods, so we could transparently handle the one socket for repl/one or more sockets for tooling.

@pesterhazy
Copy link
Contributor Author

@arichiardi, did you mean to comment on this (already merged) PR: #549? This PR is not about the socket server :)

@arichiardi
Copy link
Contributor

Lol probably not 👍

@alandipert alandipert merged commit e2d8c52 into boot-clj:master Jul 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants