Command-line tools
Overview
Dump filenames to a YAML-file. |
|
Get checksum of files listed in a (field of a) YAML-file. |
|
Copy files listed in a (field of a) YAML-file. |
|
Move files listed in a (field of a) YAML-file. |
|
Remove files listed in a (field of a) YAML-file. |
|
Collect file information from location (on a remote host). |
|
Copy files from remote, using earlier collected host-information. |
|
Copy files to remote, using earlier collected host-information. |
|
Merge a YAML-file into another YAML-file. |
|
Parse a YAML-file, and print to screen. |
|
Extract a field from a YAML-file. |
List files
shelephant_dump
Dump filenames to a YAML-file.
- usage
shelephant_dump [options] <file>…
- arguments
Files to dump. By default the filenames are written relative to the output file.
- options
- -o, --output=arg
Output YAML-file. [default: shelephant_dump.yaml]
- -a, --append
Append existing file.
- -c, --command
Interpret the input as a command (instead of as filenames).
- --abspath
Store absolute paths (default: relative to the output file).
- -s, --sort
Sort filenames.
- -f, --force
Overwrite output file without prompt.
- -h, --help
Show help.
- --version
Show version.
(c - MIT) T.W.J. de Geus | tom@geus.me | www.geus.me | github.com/tdegeus/shelephant
shelephant_checksum
Get checksum of files listed in a (field of a) YAML-file. The filenames are assumed either absolute, or relative to the input YAML-file.
- usage
shelephant_checksum [options] <input.yaml>
- argument
YAML-file with file-paths. Default: shelephant_dump.yaml
- options
- -o, --output=arg
Output YAML-file. [default: shelephant_checksum.yaml]
- -k, --key=arg
Path in the YAML-file, separated by “/”. [default: /]
- -l, --local=arg
Add local ‘host’ information to use precomputed checksums.
- -f, --force
Overwrite output file without prompt.
- -q, --quiet
Do not print progress.
- -h, --help
Show help.
- --version
Show version.
(c - MIT) T.W.J. de Geus | tom@geus.me | www.geus.me | github.com/tdegeus/shelephant
Basic copying
shelephant_cp
Copy files listed in a (field of a) YAML-file. The filenames are assumed either absolute, or relative to the input YAML-file.
- usage
shelephant_cp [options] <destination>
shelephant_cp [options] <input.yaml> <destination>
- arguments
- <input.yaml>
YAML-file with filenames. Default: shelephant_dump.yaml
- <destination>
Prefix of the destination.
- options
- -c, --checksum
Use checksum to skip files that are the same.
- --check-rsync
Check if files are different using rsync. rsync uses basic criteria such as file size and creation and modification date. This is much faster than using checksums but is only approximate. Note that rsync can also check based on checksum, enabled using
--checksum
.- --temp=arg
Temporary filename to communicate with rsync. [default: shelephant_files.txt]
- -k, --key=arg
Path in the YAML-file, separated by “/”. [default: /]
- --colors=arg
Select color scheme from: none, dark. [default: dark]
- -s, --summary
Print summary (and no details unless specified).
- -d, --details
Print details (and no summary unless specified).
- -f, --force
Move without prompt.
- -q, --quiet
Do not print progress.
- -h, --help
Show help.
- --version
Show version.
(c - MIT) T.W.J. de Geus | tom@geus.me | www.geus.me | github.com/tdegeus/shelephant
shelephant_mv
Move files listed in a (field of a) YAML-file. The filenames are assumed either absolute, or relative to the input YAML-file.
- usage
shelephant_mv [options] <destination>
shelephant_mv [options] <input.yaml> <destination>
- argument
- <input.yaml>
YAML-file with filenames. Default: shelephant_dump.yaml
- <destination>
Prefix of the destination.
- options
- -c, --checksum
Use checksum to skip files that are the same.
- -k, --key=arg
Path in the YAML-file, separated by “/”. [default: /]
- --colors=arg
Select color scheme from: none, dark. [default: dark]
- -s, --summary
Print summary (and no details unless specified).
- -d, --details
Print details (and no summary unless specified).
- -f, --force
Move without prompt.
- -q, --quiet
Do not print progress.
- -h, --help
Show help.
- --version
Show version.
(c - MIT) T.W.J. de Geus | tom@geus.me | www.geus.me | github.com/tdegeus/shelephant
shelephant_rm
Remove files listed in a (field of a) YAML-file. The filenames are assumed either absolute, or relative to the input YAML-file.
- usage
shelephant_rm [options]
shelephant_rm [options] <input.yaml>
- argument
YAML-file with filenames. Default: shelephant_dump.yaml
- options
- -k, --key=arg
Path in the YAML-file, separated by “/”. [default: /]
- -f, --force
Remove without prompt.
- -h, --help
Show help.
- --version
Show version.
(c - MIT) T.W.J. de Geus | tom@geus.me | www.geus.me | github.com/tdegeus/shelephant
Copying over SSH
shelephant_hostinfo
Collect file information from location (on a remote host).
- usage
shelephant_hostinfo [options]
- options
- -o, --output=arg
Output YAML-file. [default: shelephant_hostinfo.yaml].
- -r, --host=arg
Host-name.
- -p, --prefix=arg
Directory (on host) from which to copy.
- -f, –files=[arg]
YAML-file with list of files (on remote). [default: shelephant_dump.yaml]
- -c, –checksum=[arg]
YAML-file with checksums (on remote). [default: shelephant_checksum.yaml]
- --files-key=arg
Path in the YAML-file, separated by “/”. [default: /]
- --checksum-key=arg
Path in the YAML-file, separated by “/”. [default: /]
- --ignore
Skip basic checks.
- -i, –input=[arg]
Use host and prefix from existing file. [default: shelephant_hostinfo.yaml]
- –remove=arg…
Remove paths (and checksums) from existing file.
- --force
Overwrite output file without prompt.
- --verbose
Verbose all commands.
- -h, --help
Show help.
- --version
Show version.
(c - MIT) T.W.J. de Geus | tom@geus.me | www.geus.me | github.com/tdegeus/shelephant
shelephant_get
Copy files from remote, using earlier collected host-information.
Use shelephant_hostinfo
to collect host-information.
By default the back-end is rysnc -a --from-file="temp" host:source_dir dest_dir
.
Alternatively scp -p host:source_file dest_file
can be used.
Typically, rsync will be faster, especially in copying a lot of small files.
- usage
shelephant_get [options]
shelephant_get [options] <hostinfo.yaml>
- argument
YAML-file with host information. Default: shelephant_hostinfo.yaml
- options
- -l, --local=arg
Add local ‘host’ information to use precomputed checksums.
- --scp
Use
scp
instead ofrysnc
as backend.- --check-rsync
Check if files are different using rsync. rsync uses basic criteria such as file size and creation and modification date. This is much faster than using checksums but is only approximate. Note that rsync can also check based on checksum, enabled using
--checksum
.- --temp=arg
Temporary filename to communicate with rsync. [default: shelephant_files.txt]
- --colors=arg
Select color scheme from: none, dark. [default: dark]
- -s, --summary
Print summary (and no details unless specified).
- -d, --details
Print details (and no summary unless specified).
- -f, --force
Force overwrite of all existing (but not matching) files.
- --verbose
Verbose all commands.
- -q, --quiet
Do not print progress.
- -h, --help
Show help.
- --version
Show version.
(c - MIT) T.W.J. de Geus | tom@geus.me | www.geus.me | github.com/tdegeus/shelephant
shelephant_send
Copy files to remote, using earlier collected host-information.
Use shelephant_hostinfo
to collect host-information.
By default the back-end is rysnc -a --from-file="temp" source_dir host:dest_dir
.
Alternatively scp -p source_file host:dest_file
can be used.
Typically, rsync will be faster, especially in copying a lot of small files.
- usage
shelephant_send [options]
shelephant_send [options] <files.yaml> <hostinfo.yaml>
- arguments
- <files.yaml>
YAML-file with files to send. Default: shelephant_dump.yaml
- <hostinfo.yaml>
YAML-file with host information. Default: shelephant_hostinfo.yaml
- options
- -k, --key=arg
Path in <files.yaml>, separated by “/”. [default: /]
- -l, --local=arg
Add local ‘host’ information to use precomputed checksums.
- --scp
Use
scp
instead ofrysnc
as backend.- --check-rsync
Check if files are different using rsync. rsync uses basic criteria such as file size and creation and modification date. This is much faster than using checksums but is only approximate. Note that rsync can also check based on checksum, enabled using
--checksum
.- --temp=arg
Temporary filename to communicate with rsync. [default: shelephant_files.txt]
- --colors=arg
Select color scheme from: none, dark. [default: dark]
- -s, --summary
Print summary (and no details unless specified).
- -d, --details
Print details (and no summary unless specified).
- -f, --force
Force overwrite of all existing (but not matching) files.
- --verbose
Verbose all commands.
- -q, --quiet
Do not print progress.
- -h, --help
Show help.
- --version
Show version.
(c - MIT) T.W.J. de Geus | tom@geus.me | www.geus.me | github.com/tdegeus/shelephant
Modifying YAML-file
shelephant_merge
Merge a YAML-file into another YAML-file.
Unless you use –no-path, the function assumes that all data are paths, and changes all relative paths from being relative to <branch.yaml> or <main.yaml> to being relative to –output.
- usage
shelephant_merge [options] <branch.yaml> <main.yaml>
- arguments
- <branch.yaml>
File to merge into main.yaml.
- <main.yaml>
Main source.
- options
- -o, --output=arg
Output file. (default: <main.yaml>)
- --replace
Replace fields in <main.yaml> that are also in <branch.yaml>. (default: append)
- --skip
Skip fields in <branch.yaml> that are also in <main.yaml>.
- --no-path
Do not interpret data as paths.
- -f, --force
Overwrite output file without prompt.
- -h, --help
Show help.
- --version
Show version.
(c - MIT) T.W.J. de Geus | tom@geus.me | www.geus.me | github.com/tdegeus/shelephant
shelephant_parse
Parse a YAML-file, and print to screen.
- usage
shelephant_parse <file.yaml>
- argument
File path.
- options
- -h, --help
Show help.
- --version
Show version.
(c - MIT) T.W.J. de Geus | tom@geus.me | www.geus.me | github.com/tdegeus/shelephant
shelephant_extract
Extract a field from a YAML-file.
Unless you use –no-path, the function assumes that all data are paths, and changes all relative paths from being relative to <input.yaml> to being relative to –output.
- usage
shelephant_extract [options] <input.yaml> [<key>…]
- arguments
- <input.yaml>
The file to read.
- <key>
The keys to read from the file.
- options
- -o, --output=arg
Output file. (default: <input.yaml>)
- --no-path
Do not interpret data as paths.
- -s, --squash
Squash fields into a single field.
- -f, --force
Overwrite output file without prompt.
- -h, --help
Show help.
- --version
Show version.
(c - MIT) T.W.J. de Geus | tom@geus.me | www.geus.me | github.com/tdegeus/shelephant