Skip to content
This repository was archived by the owner on Apr 16, 2021. It is now read-only.

Commit 7bc9419

Browse files
author
David Orme
committed
A 0-arg mount command now lists current vars
1 parent 3f3a08c commit 7bc9419

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

project.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject com.bradsdeals/clojure-navigation "1.0.0-SNAPSHOT"
1+
(defproject com.bradsdeals/clojure-navigation "1.0.0"
22
:description "Tools for navigating code and data structures from Clojure along with some generic helpers."
33
:url "https://github.com/shopsmart/clojure-navigation"
44
:license {:name "Eclipse Public License"

src/bradsdeals/nav.clj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,12 @@ page, 'ls 3' the third, and so on."
120120

121121
(defmacro mount
122122
"Mount an object so that it can be interacted with using Unix-style commands like 'ls', 'cd', etc.
123-
'root' is the root object to mount."
124-
[root]
125-
`(named-mount ~root (keyword (str (quote ~root)))))
123+
If 'root' is present, it is the root object to mount, otherwise, lists all the vars in the current
124+
namespace."
125+
[& root]
126+
(if (> 0 (count root))
127+
`(named-mount ~root (keyword (str (quote ~@root))))
128+
`(ns-interns *ns*)))
126129

127130

128131
(defn named-mount
@@ -161,5 +164,3 @@ Multiple parameters may be supplied in order to change the current location by m
161164
(sequential? current) (do (named-mount (:root cursor) {pwd-key (conj pwd nextkey)} (nth current nextkey)) (ls))))
162165
(if (> (count (rest where)) 0)
163166
(recur (rest where))))))
164-
165-

0 commit comments

Comments
 (0)