diff --git a/brepl b/brepl index 584531e..3aab9f7 100755 --- a/brepl +++ b/brepl @@ -998,7 +998,7 @@ brepl documentation: https://github.com/licht1stein/brepl (println " brepl [OPTIONS] -m ") (println " brepl hooks [args]") (println " brepl skill ") - (println " brepl balance [--write]") + (println " brepl balance [--dry-run]") (println) (println "OPTIONS:") (println (cli/format-opts {:spec cli-spec :order [:e :f :m :h :p :verbose :version :help]})) @@ -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")) @@ -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))) diff --git a/src/brepl.clj b/src/brepl.clj index 40a315d..d90a5d6 100644 --- a/src/brepl.clj +++ b/src/brepl.clj @@ -52,7 +52,7 @@ (println " brepl [OPTIONS] -m ") (println " brepl hooks [args]") (println " brepl skill ") - (println " brepl balance [--write]") + (println " brepl balance [--dry-run]") (println) (println "OPTIONS:") (println (cli/format-opts {:spec cli-spec :order [:e :f :m :h :p :verbose :version :help]})) @@ -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")) @@ -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)))