<commit_before>(ns bitsplit-cli.core
    (:use bitsplit.client.protocol
          bitsplit.storage.protocol
          bitsplit-cli.commands
          bitsplit-cli.bitcoind
          bitsplit-cli.filesystem))


(def storage (->File "FAKE"))
(def client (->Bitcoind ""))

(defn read-prompt [prompt]
    (print prompt)
    (flush)
    (read-line))
(def read-in (partial read-prompt "bitsplit> "))
(defn exit? [command]
    (->> "exit"
          seq
          (= (take 4 command))))
(defn start-repl []
    (loop []
        (let [command (read-in)]
            (if-not (exit? command)
                (do 
                    (execute {
                        :storage storage
                        :command command
                        :client client
                        }) 
                    (recur))))))

(defn -main [& args]
    (if (empty? args)
        (start-repl) 
        (println "empty" args)))

; A plan:
;  define a spec for the shell, then functions to handle each commmand
;  then, just stick things in a loop and you're good. some kind 
;  of rpc-daemonization would be dope, too

; the spec
; <commit_msg>one-shot mode in place, given that execute does stuff (it doesn't)<commit_after>(ns bitsplit-cli.core
    (:use bitsplit.client.protocol
          bitsplit.storage.protocol
          bitsplit-cli.commands
          bitsplit-cli.bitcoind
          bitsplit-cli.filesystem))


(def storage (->File "FAKE"))
(def client (->Bitcoind ""))

(defn read-prompt [prompt]
    (print prompt)
    (flush)
    (read-line))
(def read-in (partial read-prompt "bitsplit> "))
(defn exit? [command]
    (->> "exit"
          seq
          (= (take 4 command))))
(defn start-repl []
    (loop []
        (let [command (read-in)]
            (if-not (exit? command)
                (do 
                    (execute {
                        :storage storage
                        :command command
                        :client client
                        }) 
                    (recur))))))

(defn -main [& args]
    (if (empty? args)
        (start-repl) 
        (execute {
            :storage storage
            :command (->> args
                        (map #(str % " "))
                        (apply str))
            :client client
            })))

; A plan:
;  define a spec for the shell, then functions to handle each command
;  then, just stick things in a loop and you're good. some kind 
;  of rpc-daemonization would be dope, too

; the spec
; 
{'fraction_non_alphanumeric': 0.12046736502820306, 'fraction_numerical': 0.0008058017727639, 'mean_word_length': 1.541453428863869, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2941776', 'n_tokens_mistral': 751, 'n_tokens_neox': 712, 'n_words': 212}