|
|
@@ -17,24 +17,24 @@
|
|
|
(date-time-util/format (tc/from-long ms) "MMM do, yyyy"))
|
|
|
|
|
|
(defn show-graph
|
|
|
- [{{:keys [graph]} :opts}]
|
|
|
- (let [graph-dir (node-path/join (cli-common-graph/get-db-graphs-dir) (common-sqlite/sanitize-db-name graph))]
|
|
|
- (if (fs/existsSync graph-dir)
|
|
|
- (let [conn (sqlite-cli/open-db! (cli-common-graph/get-db-graphs-dir) (common-sqlite/sanitize-db-name graph))
|
|
|
- kv-value #(:kv/value (d/entity @conn %))]
|
|
|
- (pprint/print-table
|
|
|
- (cond-> [{:name "Graph directory" :value graph-dir}
|
|
|
- {:name "Graph created at"
|
|
|
- :value (ms->journal-title (kv-value :logseq.kv/graph-created-at))}
|
|
|
- {:name "Graph created by commit"
|
|
|
- :value (str "https://github.com/logseq/logseq/commit/" (kv-value :logseq.kv/graph-git-sha))}
|
|
|
- {:name "Graph schema version" :value (kv-value :logseq.kv/schema-version)}
|
|
|
- {:name "Graph initial schema version" :value (kv-value :logseq.kv/graph-initial-schema-version)}]
|
|
|
- (d/entity @conn :logseq.kv/import-type)
|
|
|
- (conj {:name "Graph imported by" :value (kv-value :logseq.kv/import-type)}))))
|
|
|
- (do
|
|
|
- (println "Graph" (pr-str graph) "does not exist")
|
|
|
- (js/process.exit 1)))))
|
|
|
+ [{{:keys [graphs]} :opts}]
|
|
|
+ (doseq [graph graphs]
|
|
|
+ (let [graph-dir (node-path/join (cli-common-graph/get-db-graphs-dir) (common-sqlite/sanitize-db-name graph))]
|
|
|
+ (if (fs/existsSync graph-dir)
|
|
|
+ (let [conn (sqlite-cli/open-db! (cli-common-graph/get-db-graphs-dir) (common-sqlite/sanitize-db-name graph))
|
|
|
+ kv-value #(:kv/value (d/entity @conn %))]
|
|
|
+ (pprint/print-table
|
|
|
+ (map #(array-map "Name" (first %) "Value" (second %))
|
|
|
+ (cond-> [["Graph directory" graph-dir]
|
|
|
+ ["Graph created at" (ms->journal-title (kv-value :logseq.kv/graph-created-at))]
|
|
|
+ ["Graph schema version" (kv-value :logseq.kv/schema-version)]
|
|
|
+ ["Graph initial schema version" (kv-value :logseq.kv/graph-initial-schema-version)]]
|
|
|
+ (d/entity @conn :logseq.kv/graph-git-sha)
|
|
|
+ (conj ["Graph created by commit"
|
|
|
+ (str "https://github.com/logseq/logseq/commit/" (kv-value :logseq.kv/graph-git-sha))])
|
|
|
+ (d/entity @conn :logseq.kv/import-type)
|
|
|
+ (conj ["Graph imported by" (kv-value :logseq.kv/import-type)])))))
|
|
|
+ (println "Graph" (pr-str graph) "does not exist")))))
|
|
|
|
|
|
(defn list-graphs
|
|
|
[]
|