Commits

Hugh Giddens committed 177739b

Fix function documentation strings.

Comments (0)

Files changed (1)

   (when-not (exists? path)
     (throw (IllegalArgumentException. (str path " not found")))))
 
-(defn copy [from to]
+(defn copy
   "Copy a file from 'from' to 'to'. Return 'to'."
+  [from to]
   (assert-exists from)
   (io/copy (io/as-file from) (io/as-file to))
   to)
                                                   curly-depth)
          :else (recur (next stream) (str re c) curly-depth)))))
 
-(defn glob [pattern]
+(defn glob
   "Returns files matching glob pattern."
+  [pattern]
   (let [parts (split pattern)
         root (if (= (count parts) 1) "." (apply join (butlast parts)))
         regex (glob->regex (last parts))]
                                             (boolean (re-find regex 
                                                               filename)))))))))
 
-(defn- iterzip [z]
+(defn- iterzip
   "Iterate over a zip, returns a sequence of the nodes with a nil suffix"
+  [z]
   (when-not (zip/end? z)
     (cons (zip/node z) (lazy-seq (iterzip (zip/next z))))))
 
         files (set (map f-base (filter (complement f-dir?) kids)))]
     [(strinfify root) dirs files]))
 
-(defn iterdir [path]
+(defn iterdir
   "Return a sequence [root dirs files], starting from path"
+  [path]
   (map walk-map-fn (iterdir* path)))
 
-(defn walk [path func]
+(defn walk
   "Walk over directory structure. Calls 'func' with [root dirs files]"
+  [path func]
   (dorun (map #(apply func %) (iterdir path))))
 
-(defn touch [path & time]
+(defn touch
   "Set file modification time (default to now). Returns path."
+  [path & time]
   (let [file (ensure-file path)]
     (.setLastModified file (if time (first time) (System/currentTimeMillis)))
     path))
 
-(defn chmod [mode path]
+(defn chmod
   "Change file permissions. Returns path.
 
   'mode' can be any combination of \"r\" (readable) \"w\" (writable) and \"x\"
   Examples:
   (chmod \"+x\" \"/tmp/foo\") -> Sets executable for everyone
   (chmod \"u-wx\" \"/tmp/foo\") -> Unsets owner write and executable"
+  [mode path]
   (assert-exists path)
   (let [[_ u op permissions] (re-find #"^(u?)([+-])([rwx]{1,3})$" mode)]
     (when (nil? op) (throw (IllegalArgumentException. "Bad mode")))
       (when (perm-set \x) (.setExecutable file flag user)))
     path))
 
-(defn copy+ [src dest]
+(defn copy+
   "Copy src to dest, create directories if needed."
+  [src dest]
   (mkdirs (dirname dest))
   (copy src dest))
 
-(defn copy-tree [from to]
+(defn copy-tree
   "Copy a directory from 'from' to 'to'."
+  [from to]
   (when (file? to) 
     (throw (IllegalArgumentException. (format "%s is a file" to))))
   (let [from (normpath from)
         (dorun (map #(copy+ (join root %) (dest (join root %))) files))))
     to))
 
-(defn deltree [root]
+(defn deltree
   "Delete a directory tree."
+  [root]
   (when (directory? root)
     (dorun (map deltree (map #(join root %) (.list (io/as-file root))))))
   (delete root))
 
-(defn home []
+(defn home
   "User home directory"
+  []
   (System/getProperty "user.home"))
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.