Skip to content

Commit 916ff1f

Browse files
committed
feat: clawe.cli namespace and sketch of helpers
These work but are not parseable yet. Tho maybe you's pass to `bb -o` and do edn -> json via jet from there?
1 parent e9df775 commit 916ff1f

File tree

4 files changed

+59
-12
lines changed

4 files changed

+59
-12
lines changed

src/blog/config.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535

3636
(def blog-edn (blog-content-config))
3737

38-
(defn ->config [] (aero/read-config blog-edn))
38+
(defn ->config []
39+
nil
40+
#_(aero/read-config blog-edn))
3941

4042
(defsys ^:dynamic *config* :start
4143
(log/log! :info "[BLOG-CONFIG]: Restarting *config*")

src/clawe/cli.clj

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
(ns clawe.cli
2+
(:require
3+
[clojure.string :as string]
4+
[clawe.config :as clawe.config]))
5+
6+
;; TODO support ops like these with smth like -j
7+
;; take jq insight, read bb-cli for parsing/output inspo
8+
;; use to support scripts like *-in-wsp details
9+
;; first-file, wsp-directory, wsp-git-status
10+
;; related common apps and urls
11+
;; cheatsheets and relevant keybindings
12+
13+
(defn workspace-def [{:as _opts :keys [title]}]
14+
(clawe.config/workspace-def title))
15+
16+
(defn workspace-dir [opts]
17+
(-> opts workspace-def :workspace/directory))
18+
19+
(defn preferred-index [opts]
20+
(-> opts workspace-def :workspace/preferred-index))
21+
22+
(defn git-status [opts]
23+
(-> opts workspace-def :git/status))
24+
25+
(defn repo-dirs [opts]
26+
(->>
27+
(clawe.config/workspace-defs)
28+
(map (fn [[k def]] [k (:workspace/directory def)]))))
29+
30+
(defn my-repo-dirs [opts]
31+
(->>
32+
(clawe.config/workspace-defs)
33+
(filter (comp :workspace/directory second))
34+
(filter (fn [[_ def]] (string/includes? (:workspace/directory def) "russmatney")))
35+
(map (fn [[k def]] [k (:workspace/directory def)]))
36+
(map str)
37+
(string/join "\n")
38+
;; (into {})
39+
))

src/clawe/config.clj

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,21 @@
155155
;; workspace-defs
156156
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
157157

158-
(defn workspace-defs []
159-
(sys/start! `*config*)
160-
(:workspace/defs @*config* {}))
158+
(defn workspace-defs
159+
([] (workspace-defs nil))
160+
([_opts]
161+
(sys/start! `*config*)
162+
(let [defs (:workspace/defs @*config* {})]
163+
defs)))
161164

162-
(defn workspace-defs-with-titles []
163-
(sys/start! `*config*)
164-
(->> (:workspace/defs @*config* {})
165-
(map (fn [[k def]]
166-
[k (assoc def :workspace/title k)]))
167-
(into {})))
165+
(defn workspace-defs-with-titles
166+
([] (workspace-defs-with-titles nil))
167+
([_opts]
168+
(sys/start! `*config*)
169+
(->> (:workspace/defs @*config* {})
170+
(map (fn [[k def]]
171+
[k (assoc def :workspace/title k)]))
172+
(into {}))))
168173

169174
(defn workspace-def [workspace-title]
170175
((workspace-defs) workspace-title))

src/clawe/mx.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,9 @@ hi there
278278
(defn open-new-wsp-with-emacs [w]
279279
(workspace.open/open-new-workspace w)
280280

281-
(client.create/create-client "emacs" {:current-workspace w})
282-
(client.create/create-client "terminal" {:current-workspace w}))
281+
;; (client.create/create-client "emacs" {:current-workspace w})
282+
(client.create/create-client "terminal" {:current-workspace w})
283+
)
283284

284285
(defn test-fn [key]
285286
(if-let [wm (wm/key->workspace key)]

0 commit comments

Comments
 (0)