Liking cljdoc? Tell your friends :D

auto-build.os.file

Tools to manipulate local files

Is a proxy to babashka.fs tools.

Tools to manipulate local files

Is a proxy to babashka.fs tools.
raw docstring

combine-filesclj

(combine-files printers target-filepath & src-filepathes)

Read text content of files src-filepathes - in the order of the sequence - and combine them into target-filepath.

Read text content of files `src-filepathes` - in the order of the sequence - and combine them into `target-filepath`.
sourceraw docstring

copy-actionclj

(copy-action path src-dirpath dst-dirpath)
(copy-action path src-dirpath dst-dirpath options)

Copy a file at path in a subdir of src-dirpath to dst-dirpath.

The options could be :replace-existing :copy-attributes. Returns:

  • :path given path
  • :apath the absolute path
  • :type could be :file :directory
  • :exist?
  • :dst-dirpath
  • :options
  • :relative-path
  • :target-path
Copy a file at `path` in a subdir of `src-dirpath` to `dst-dirpath`.

The `options` could be `:replace-existing` `:copy-attributes`. Returns:
  * `:path` given path
  * `:apath` the absolute path
  * `:type` could be `:file` `:directory`
  * `:exist?`
  * `:dst-dirpath`
  * `:options`
  * `:relative-path`
  * `:target-path`
sourceraw docstring

copy-dirclj

(copy-dir src-path dst-path)
(copy-dir src-path dst-path options)
source

copy-fileclj

(copy-file src-filepath dst-path options)

Copy src-filepath to dst-path, that could be a filepath, or a directory where the file will be stored. Returns nil

Copy `src-filepath` to `dst-path`, that could be a filepath, or a directory where the file will be stored.
Returns `nil`
sourceraw docstring

(create-sym-link filepath target)

Creates a sym link to target linking to filepath. Returns filepath

Creates a sym link to `target` linking to `filepath`.
Returns `filepath`
sourceraw docstring

create-temp-dirclj

(create-temp-dir)
(create-temp-dir sub-dir)

Returns a subdirectory path string of the system temporary directory. sub-dir is an optional string, each one is a sub directory.

Returns a subdirectory path string of the system temporary directory.
`sub-dir` is an optional string, each one is a sub directory.
sourceraw docstring

create-temp-fileclj

(create-temp-file)
(create-temp-file filepath)

Create a temporary file.

  • The file is stored in the system temporary directory.
  • The file is suffixed with filepath (optional).
Create a temporary file.
- The file is stored in the system temporary directory.
- The file is suffixed with `filepath` (optional).
sourceraw docstring

delete-dirclj

(delete-dir dirpath)

Deletes the directory at dirpath and returns dirpath if deleted. Returns nil otherwise

Deletes the directory at `dirpath` and returns `dirpath` if deleted. Returns `nil` otherwise
sourceraw docstring

delete-fileclj

(delete-file filepath)

Deletes filepath and returns it. If filepath does not exist, returns nil.

Deletes `filepath` and returns it.
If `filepath` does not exist, returns nil.
sourceraw docstring

delete-pathclj

(delete-path path)

Deletes path and returns it. Returns nil if the path does not exists.

Deletes `path` and returns it.
Returns nil if the `path` does not exists.
sourceraw docstring

do-copy-actionclj

(do-copy-action {:keys [type path dst-dirpath target-path options exist?]
                 :as copy-action})

Do the actual copy of copy-action, enrich it with :status (:copy-fail or :success)

Do the actual copy of `copy-action`, enrich it with `:status` (`:copy-fail` or `:success`)
sourceraw docstring

ensure-dir-existsclj

(ensure-dir-exists dirpath)

Creates directory dirpath if not already existing. Return dirpath if succesful, nil if creation has failed

Creates directory `dirpath` if not already existing.
Return `dirpath` if succesful, `nil` if creation has failed 
sourceraw docstring

ensure-empty-dirclj

(ensure-empty-dir dirpath)

Ensure the directory dirpath is existing and empty.

Ensure the directory `dirpath` is existing and empty.
sourceraw docstring

expand-home-strclj

(expand-home-str path)

Return path where ~ is expanded to the actual value of the current home directory.

Return `path` where `~` is expanded to the actual value of the current home directory.
sourceraw docstring

is-existing-dir?clj

(is-existing-dir? dirpath)

Returns dirpath if this the path exists and is a directory.

Returns `dirpath` if this the path exists and is a directory.
sourceraw docstring

is-existing-file?clj

(is-existing-file? filepath)

Returns the filepath if it already exists and is a regular file. Returns nil otherwise.

Returns the `filepath` if it already exists and is a regular file. Returns `nil` otherwise.
sourceraw docstring

is-existing-path?clj

(is-existing-path? path)

Returns true if path path already exist.

Returns true if `path` path already exist.
sourceraw docstring

make-executableclj

(make-executable filepath)

Make file filepath executable. Returns filepath

Make file `filepath` executable.
Returns `filepath`
sourceraw docstring

matching-filesclj

(matching-files dirpath file-pattern)

Match files recursively found in dirpath that are matching file-pattern.

Match files recursively found in `dirpath` that are matching `file-pattern`.
sourceraw docstring

modified-sinceclj

(modified-since anchor-filepath file-set)

Returns true if anchor-filepath is older than one of the file in file-set.

Returns `true` if `anchor-filepath` is older than one of the file in `file-set`.
sourceraw docstring

path-on-diskclj

(path-on-disk path)

Returns a map with informations on the existance of path as found on the disk. As all path functions, it could be a file or a directory.

It returns:

  • :path given path
  • :apath the absolute path
  • :type could be :file :directory
  • :exist?
Returns a map with informations on the existance of `path` as found on the disk.
As all `path` functions, it could be a file or a directory.

It returns:
* `:path` given path
* `:apath` the absolute path
* `:type` could be `:file` `:directory`
* `:exist?`
sourceraw docstring

pp-fileclj

(pp-file filepath file-content)

Pretty print content file-content into file filepath.

Pretty print content `file-content` into file `filepath`.
sourceraw docstring

read-fileclj

(read-file {:keys [errorln uri-str exception-msg] :as _printers} filepath)

Read the file named filepath.

Returns:

  • :filepath as given as a parameter
  • :afilepath file with absolute path
  • :status is :success or :file-loading-fail
  • :raw-content (only if :status is :success)
  • :exception (only if :status is :file-loading-fail)

That functions print on the cli:

  • nothing if successful or if printers are nil
  • an error message and the message of the exception if the file can't be read.
Read the file named `filepath`.

Returns:
  * `:filepath` as given as a parameter
  * `:afilepath` file with absolute path
  * `:status` is `:success` or `:file-loading-fail`
  * `:raw-content` (only if `:status` is `:success`)
  * `:exception` (only if `:status` is `:file-loading-fail`)

  That functions print on the cli:
  * nothing if successful or if printers are nil
  * an error message and the message of the exception if the file can't be read.
sourceraw docstring

search-filesclj

(search-files dirpath pattern)
(search-files dirpath pattern options)

Search files and dirs.

  • dirpath is where the root directory of the search-files
  • pattern is a regular expression or a glob as described in java doc
  • options (Optional, default = {}) are boolean value for :hidden, :recursive and :follow-lins. See babashka fs for details. For instance:
  • (files/search-files "" "**{.clj,.cljs,.cljc,.edn}") search all clj file-paths in pwd directory
Search files and dirs.
* `dirpath` is where the root directory of the search-files
* `pattern` is a regular expression or a glob as described in [java doc](https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String))
* `options` (Optional, default = {}) are boolean value for `:hidden`, `:recursive` and `:follow-lins`. See [babashka fs](https://github.com/babashka/fs/blob/master/API.md#glob) for details.
For instance:
* `(files/search-files "" "**{.clj,.cljs,.cljc,.edn}")` search all clj file-paths in pwd directory
sourceraw docstring

search-in-parentsclj

(search-in-parents dirpath file-or-dir)

Search file-or-dir in the parents directories of dirpath.

Search `file-or-dir` in the parents directories of `dirpath`.
sourceraw docstring

write-fileclj

(write-file filepath
            {:keys [errorln exception-msg normalln uri-str] :as _printers}
            content)

Write the content in the file at filepath .

Returns

  • :filepath as given as a parameter
  • :afilepath file with absolute path
  • :status is :success or :file-writing-fail
  • :raw-content if file can be read.
  • :exception (only if :status is :file-writing-fail)
Write the `content` in the file at `filepath` .

Returns
* `:filepath` as given as a parameter
* `:afilepath` file with absolute path
* `:status` is `:success` or `:file-writing-fail`
* `:raw-content` if file can be read.
* `:exception` (only if `:status` is `:file-writing-fail`)
sourceraw docstring

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

× close