A deno tool to handle directories a files. Inspired by rimraf and mkdirp mkdirp, fs-cli aims to write build scripts that can run under any shells.
$ deno install --unstable --allow-read --allow-write --allow-env --allow-run -n fs_cli https://deno.land/x/fs_cli@v0.5.1/cli.ts
The above command will always install the latest version. If you’re updating from an older version you might need to run the command with the -f
flag.
To install a specific version, run the install command with a specific version tag:
$ deno install --unstable --allow-read --allow-write --allow-env --allow-run -n fs_cli https://deno.land/x/fs_cli@<version>/cli.ts
To install a specific version, run the install command with a specific version tag:
$ deno install --unstable --allow-read --allow-write --allow-env --allow-run -n fs_cli https://deno.land/x/fs_cli@<version>/cli.ts
For more information see Deno’s installer manual
Syntax:
fs-cli cp <source path1 or glob1>...<source pathN glob1> <dest>
Perform a cp -r. If includes directories, thos directories are created if they does not exists.
fs-cli cp <source file> <dest dile>
fs-cli cp <source file> <dest dir>/ or fs-cli cp <source file> <dest dir>\
fs-cli cp <source file> <dest dir>/<dest file> or fs-cli cp <source file> <dest dir>\<dest file>
fs-cli cp <source file1> ... <source filen> <dest dir>
fs-cli cp <source dir path> <dest dir path>
cp supports glob options
Be default the command failed if a file has to be over written. -f/–force option allow to over write existing file
if use, set last modification and access times to the ones of the original source files. When not use, timestamp behavior is OS-dependent.
Syntax:
fs-cli emptyDir <dir1>...<dirn>
Ensures that each dir is empty. Deletes directory contents if the directory is not empty. If the directory does not exist, it is created.
Syntax:
fs-cli mkdirp <path1> <path2> <path3>
Perform an mkdir -p on each given directory.
Syntax:
fs-cli rm <path or glob 1> <path or glob 2> ... <path or glob N>
Perform an rm -rf on each given directory and file. Globs are also supported. If a path does not exist, fs-cli ignores it and processes the next one.
rm supports glob options
Following are used for rm and cp
To use glob intergated search rather than shell glob interpollation, don’t forget to use quote to avoid glob being interpreted by sheel use quote: '**/_.tmp'_
rahter than **/
.tmp
root search for glob
fs-cli <command> <path or glob 1>...<path or glob N> --glob-root <path>
Directories are ignored when applying a glob
fs-cli <command> <path or glob 1>...<path or glob N> --no-glob-dirs
files are ignored when applying a glob
fs-cli <command> <path or glob 1>...<path or glob N> --no-glob-files
Output can be disable using -q/–quiet option:
fs-cli rm <path1> <path2> ... <pathN> -q
In case of failure, error message is always displayed, even in quiet mode.
-d/–dry: Output the behavior, but does nothing
fs-cli rm <path1> <path2> ... <pathN> -d
Author: franckLdx
Source Code: https://github.com/franckLdx/fs_cli
#deno #node #nodejs #javascript