Liking cljdoc? Tell your friends :D

lambdaisland.shellutils

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
raw docstring

*cwd*clj

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.
sourceraw docstring

absolute?clj

(absolute? f)

The File contains an absolute path

The File contains an absolute path
sourceraw docstring

basenameclj

(basename path)

Get the name of the file without any directory components

Get the name of the file without any directory components
sourceraw docstring

bashclj

(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.
sourceraw docstring

canonicalizeclj

(canonicalize path)

Return a canonical path

Resolves symlinks and makes relative paths absolute

Return a canonical path

Resolves symlinks and makes relative paths absolute
sourceraw docstring

cli-optsclj

(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.
sourceraw docstring

dirnameclj

source

extensionclj

(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).
sourceraw docstring

fatalclj

(fatal & msg)
source

fileclj

(file path)

java.io.File constructor

Resolves relative paths relative to *cwd*

java.io.File constructor

Resolves relative paths relative to [[*cwd*]]
sourceraw docstring

filter-filesclj

(filter-files files re)

Filter list of files for names matching pattern re

Filter list of files for names matching pattern re
sourceraw docstring

globclj

(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.
sourceraw docstring

Joinablecljprotocol

joinclj

(join this that)

Join Strings, Paths, and Files into a single Path.

Join Strings, Paths, and Files into a single Path.
source

lsclj

(ls dir)

List directory contents

List directory contents
sourceraw docstring

mkdir-pclj

(mkdir-p dir)

Make directory including parents

Make directory including parents
sourceraw docstring

parent-fileclj

(parent-file dir)
source

process-builderclj

(process-builder args)
source

relative?clj

(relative? f)

The File contains a relative path

The File contains a relative path
sourceraw docstring

relativizeclj

(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
sourceraw docstring

slurp-cwdclj

(slurp-cwd f)
source

spawnclj

(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 code
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 code
sourceraw docstring

spit-cwdclj

(spit-cwd f c)
source

strip-extclj

(strip-ext file)

Remove the extension from the file

Remove the extension from the file
sourceraw docstring

temp-dirclj

(temp-dir)
(temp-dir path)
source

with-cwdcljmacro

(with-cwd cwd & body)

Execute body with *cwd* set to cwd.

Execute `body` with [[*cwd*]] set to `cwd`.
sourceraw docstring

with-temp-cwdcljmacro

(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.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close