Globbing and other shell-like filename handling, and subshell handling
Extracted from https://github.com/lambdaisland/open-source and further improved
Globbing and other shell-like filename handling, and subshell handling Extracted from https://github.com/lambdaisland/open-source and further improved
Current working directory
Relative paths are resolved starting from this location, and it is used for subshells. Defaults to the CWD of the JVM, as exposed through the 'user.dir' property.
Current working directory Relative paths are resolved starting from this location, and it is used for subshells. Defaults to the CWD of the JVM, as exposed through the 'user.dir' property.
(absolute? f)
The File contains an absolute path
The File contains an absolute path
(basename path)
Get the name of the file without any directory components
Get the name of the file without any directory components
(bash & args)
Interpret the command as a bash script, allows using redirects, pipes and other bash features.
Interpret the command as a bash script, allows using redirects, pipes and other bash features.
(canonicalize path)
Return a canonical path
Resolves symlinks and makes relative paths absolute
Return a canonical path Resolves symlinks and makes relative paths absolute
(cli-opts)
Options map from lambdaisland.cli, if it is used. We auto-detect certain flags, like --dry-run.
Options map from lambdaisland.cli, if it is used. We auto-detect certain flags, like --dry-run.
(extension file)
Get the extension of the file without the dot
This function does not have special handling for files that start with a dot (hidden files on Unix-family systems).
Get the extension of the file without the dot This function does not have special handling for files that start with a dot (hidden files on Unix-family systems).
(file path)
java.io.File constructor
Resolves relative paths relative to *cwd*
java.io.File constructor Resolves relative paths relative to [[*cwd*]]
(filter-files files re)
Filter list of files for names matching pattern re
Filter list of files for names matching pattern re
(glob pattern)
Returns a seq of java.io.File instances that match the given glob pattern. Ignores dot files unless explicitly included.
Examples: (glob ".{jpg,gif}") (glob ".") (glob "/usr//se")
Based on https://github.com/jkk/clj-glob/blob/b1df67efb003f0e372c914346209d41c6df78e20/src/org/satta/glob.clj
but with some improvements.
Returns a seq of java.io.File instances that match the given glob pattern. Ignores dot files unless explicitly included. Examples: (glob "*.{jpg,gif}") (glob ".*") (glob "/usr/*/se*") Based on https://github.com/jkk/clj-glob/blob/b1df67efb003f0e372c914346209d41c6df78e20/src/org/satta/glob.clj but with some improvements.
(join this that)
Join Strings, Paths, and Files into a single Path.
Join Strings, Paths, and Files into a single Path.
(mkdir-p dir)
Make directory including parents
Make directory including parents
(relative? f)
The File contains a relative path
The File contains a relative path
(relativize base path)
Turn an absolute path and a base path into a relative path
Turn an absolute path and a base path into a relative path
(spawn & args)
Like [[clojure.java.shell/sh]], but inherit IO stream from the parent process, and prints out the invocation. By default terminates when a command fails (non-zero exit code).
If the last argument is a map, it is used for options
:dir
Directory to execute in:continue-on-error?
Should a non-zero exit code be ignored.:fail-message
Error message to show when the command returns a non-zero exit codeLike [[clojure.java.shell/sh]], but inherit IO stream from the parent process, and prints out the invocation. By default terminates when a command fails (non-zero exit code). If the last argument is a map, it is used for options - `:dir` Directory to execute in - `:continue-on-error?` Should a non-zero exit code be ignored. - `:fail-message` Error message to show when the command returns a non-zero exit code
(strip-ext file)
Remove the extension from the file
Remove the extension from the file
(with-cwd cwd & body)
Execute body
with *cwd*
set to cwd
.
Execute `body` with [[*cwd*]] set to `cwd`.
(with-temp-cwd & body)
Same as with-cwd except that it creates a temp dir in cwd and evals the body inside it.
It cleans up the temp dir afterwards also removing any temp files created within it.
Same as with-cwd except that it creates a temp dir in *cwd* and evals the body inside it. It cleans up the temp dir afterwards also removing any temp files created within it.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close