Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions brepl
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ brepl documentation: https://github.com/licht1stein/brepl
(println " brepl [OPTIONS] -m <message>")
(println " brepl hooks <subcommand> [args]")
(println " brepl skill <subcommand>")
(println " brepl balance <file> [--write]")
(println " brepl balance <file> [--dry-run]")
(println)
(println "OPTIONS:")
(println (cli/format-opts {:spec cli-spec :order [:e :f :m :h :p :verbose :version :help]}))
Expand All @@ -1022,7 +1022,8 @@ brepl documentation: https://github.com/licht1stein/brepl
(println " brepl -f script.clj")
(println " brepl -m '{\"op\" \"describe\"}'")
(println " brepl -p 7888 '(println \"Hello\")'")
(println " BREPL_PORT=7888 brepl '(+ 1 2)'"))
(println " BREPL_PORT=7888 brepl '(+ 1 2)'")
(println " brepl balance src/core.clj # Fix unbalanced brackets"))

(defn read-nrepl-port []
(when (.exists (io/file ".nrepl-port"))
Expand Down Expand Up @@ -1745,11 +1746,12 @@ brepl documentation: https://github.com/licht1stein/brepl
(System/exit 0))

(defn handle-balance [args]
(let [dry-run? (some #(= "--dry-run" %) args)
file-args (remove #(= "--dry-run" %) args)
(let [help? (some #(contains? #{"-h" "--help" "-?"} %) args)
dry-run? (some #(= "--dry-run" %) args)
file-args (remove #(contains? #{"-h" "--help" "-?" "--dry-run"} %) args)
file-path (first file-args)]
(cond
(nil? file-path)
(or help? (nil? file-path))
(show-balance-help)

(not (.exists (io/file file-path)))
Expand Down
12 changes: 7 additions & 5 deletions src/brepl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
(println " brepl [OPTIONS] -m <message>")
(println " brepl hooks <subcommand> [args]")
(println " brepl skill <subcommand>")
(println " brepl balance <file> [--write]")
(println " brepl balance <file> [--dry-run]")
(println)
(println "OPTIONS:")
(println (cli/format-opts {:spec cli-spec :order [:e :f :m :h :p :verbose :version :help]}))
Expand All @@ -76,7 +76,8 @@
(println " brepl -f script.clj")
(println " brepl -m '{\"op\" \"describe\"}'")
(println " brepl -p 7888 '(println \"Hello\")'")
(println " BREPL_PORT=7888 brepl '(+ 1 2)'"))
(println " BREPL_PORT=7888 brepl '(+ 1 2)'")
(println " brepl balance src/core.clj # Fix unbalanced brackets"))

(defn read-nrepl-port []
(when (.exists (io/file ".nrepl-port"))
Expand Down Expand Up @@ -799,11 +800,12 @@
(System/exit 0))

(defn handle-balance [args]
(let [dry-run? (some #(= "--dry-run" %) args)
file-args (remove #(= "--dry-run" %) args)
(let [help? (some #(contains? #{"-h" "--help" "-?"} %) args)
dry-run? (some #(= "--dry-run" %) args)
file-args (remove #(contains? #{"-h" "--help" "-?" "--dry-run"} %) args)
file-path (first file-args)]
(cond
(nil? file-path)
(or help? (nil? file-path))
(show-balance-help)

(not (.exists (io/file file-path)))
Expand Down