Janet 1.27.0-01aab66 Documentation
(Other Versions: 1.26.0 1.25.1 1.24.0 1.23.0 1.22.0 1.21.0 1.20.0 1.19.0 1.18.1 1.17.1 1.16.1 1.15.0 1.13.1 1.12.2 1.11.1 1.10.1 1.9.1 1.8.1 1.7.0 1.6.0 1.5.1 1.5.0 1.4.0 1.3.1 )

Shell Utilities

Index

sh/copy sh/copy-file sh/create-dirs sh/devnull sh/exec sh/exec-fail sh/exec-slurp sh/exec-slurp-all sh/exists? sh/list-all-files sh/make-new-file sh/rm sh/scan-directory

function (sh/copy src dest)
Copy a file or directory recursively from one location to another.
Expects input to be unix style paths
Community Examples / source
function (sh/copy-file src-path dst-path)
Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.
Community Examples / source
function (sh/create-dirs dir-path)
Create all directories in path specified as string including itself.
Community Examples / source
function (sh/devnull )
get the /dev/null equivalent of the current platform as an open file
Community Examples / source
function (sh/exec & args)
Execute command specified by args returning it's exit code
Community Examples / source
function (sh/exec-fail & args)
Execute command specified by args, fails when command exits with non-zero exit code
Community Examples / source
function (sh/exec-slurp & args)
Read stdout of command specified by args and return it trimmed in a string.
Community Examples / source
function (sh/exec-slurp-all & args)
Read stdout and stderr of subprocess and return it trimmed in a struct with :err and :out containing the output as string.
This will also return the exit code under the :status key.
Community Examples / source
function (sh/exists? path)
Check if the given file or directory exists. (Follows symlinks)
Community Examples / source
function (sh/list-all-files dir &opt into)
List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.
Community Examples / source
function (sh/make-new-file file-path &opt mode)
Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).
Community Examples / source
function (sh/rm path)
Remove a directory and all sub directories recursively.
Community Examples / source
function (sh/scan-directory dir func)
Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.
Community Examples / source