                     [(str/join "/" new-path)]))
                (seq (:files cwd))))))
    
-(defn commands [dir]
-  (let [files (seq (:files dir))]
-    (apply concat 
-           ;; Flattened list of lists of command structures
-           (map #(cond
-                   (= :dir (:type (second %))) (commands (second %))
-                   (and (= :file (:type (second %))) (contains? (:mod (second %)) :x)) [(assoc (second %) :name (first %))]
-                   :default [])
-                files))))
-
-(defn command-trie []
-  (let [c (map :name (commands (:root @(fs-cursor))))]
-    (trie/build c)))
-    
-(defn command-map []
-  (reduce #(assoc %1 (:name %2) %2) {} (commands (:root @(fs-cursor)))))
-
 (defn args-trie [args-spec]
   (cond
     ;; Looking for a valid filename

                          :files {"ls" {:mod #{:x}
                                        :type :file
                                        :fn ls
                                        :args []}
                                  "cd" {:mod #{:x}
                                        :type :file
                                        :fn cd
                                        :args [:file]}
                                  "clear" {:mod #{:x}
                                           :type :file
                                           :fn clear
                                           :args []}}}
                   "usr" {:mod #{:r}
                          :type :dir
                          :files {}}}}

      (if (empty? cwd)
        (trie/build (cons ".." (files cwd)))
        (trie/build (files cwd))))
    ;; Looking for a valid command
    (= :cmd args-spec)
    (trie/build (keys (command-map)))
    ;; Pre-specified parameters
    :default
    (trie/build args-spec)))
