https://github.com/blurgyy/tinytools
🛠A collection of tools that enhance your experience in shell.
https://github.com/blurgyy/tinytools
cli rust shell tool
Last synced: over 1 year ago
JSON representation
🛠A collection of tools that enhance your experience in shell.
- Host: GitHub
- URL: https://github.com/blurgyy/tinytools
- Owner: blurgyy
- Created: 2021-07-01T17:23:32.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-02T06:17:49.000Z (over 3 years ago)
- Last Synced: 2025-02-28T05:57:43.825Z (over 1 year ago)
- Topics: cli, rust, shell, tool
- Language: Rust
- Homepage: https://crates.io/crates/tinytools
- Size: 76.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tinytools
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`][bak]: Append a tilde \(\~\) to the names of given files/directories.
- [`debak`][debak]: Pop a tilde \(\~\) from the names of given files/directories.
- [`gr`][gr]: Get the nearest git root above current working directory (if it exists).
## Installation
Installing with `cargo`:
```shell
$ cargo install tinytools
```
## Utilities
### `bak`
Sometimes 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:
```shell
$ alias bak="tt bak"
$ touch testfile
$ mkdir testdir
$ ls
testdir/ testfile
$ bak testdir testfile
renamed "testfile" -> "testfile~"
renamed "testdir" -> "testdir~"
```
`bak` aborts if the path after appending a tilde exists in the filesystem.
### `debak`
`debak` is the inverse of `bak` (see: [`bak`][bak]). It does nothing (and
aborts) when any of the given path does not end with a tilde.
### `gr`
Sometimes you want to quickly go to nearest git root of current project. Add
this shell alias to your shell's initialization script:
```shell
$ alias cg='cd ${$(tt gr 2>/dev/null):-$PWD}'
```
Then, call `cg` to quickly jump from your cwd to git root:
```shell
$ pwd
[...]/tinytools/src/modules
$ cg
$ pwd
[...]/tinytools
$ cd -
$ pwd
[...]/tinytools/src/modules
```
[bak]: #user-content-bak
[debak]: #user-content-debak
[gr]: #user-content-gr