| Crates.io | tinytools |
| lib.rs | tinytools |
| version | 1.1.2 |
| created_at | 2021-06-29 14:56:46.634863+00 |
| updated_at | 2021-07-25 06:53:56.176881+00 |
| description | A collection of tools that enhance your experience in shell. |
| homepage | |
| repository | https://github.com/blurgyy/tinytools |
| max_upload_size | |
| id | 416190 |
| size | 18,757 |
A collection of tools that enhance your experience in shell. This provides an
executable named tt, which in turn provides the following utilities (more to
be added):
bak: Append a tilde (~) to the names of given files/directories.debak: Pop a tilde (~) from the names of given files/directories.gr: Get the nearest git root above current working directory (if it exists).Installing with cargo:
$ cargo install tinytools
bakSometimes you want to quickly backup some file, this is typically done by
suffixing the file with a tilde (~). When there are multiple files to be
renamed, bak helps you to do this at ease:
$ alias bak="tt bak"
$ touch testfile
$ mkdir testdir
$ ls
testdir/ testfile
$ bak testdir testfile
renamed "<absolute path>/testfile" -> "<absolute path>/testfile~"
renamed "<absolute path>/testdir" -> "<absolute path>/testdir~"
bak aborts if the path after appending a tilde exists in the filesystem.
debakdebak is the inverse of bak (see: bak). It does nothing (and
aborts) when any of the given path does not end with a tilde.
grSometimes you want to quickly go to nearest git root of current project. Add this shell alias to your shell's initialization script:
$ alias cg='cd ${$(tt gr 2>/dev/null):-$PWD}'
Then, call cg to quickly jump from your cwd to git root:
$ pwd
/home/r2d2/repos/tinytools/src/modules
$ cg
$ pwd
/home/r2d2/repos/tinytools
$ cd -
$ pwd
/home/r2d2/repos/tinytools/src/modules