atuin/README.md

174 lines
3.8 KiB
Markdown
Raw Normal View History

2021-02-13 05:55:53 -07:00
<h1 align="center">
A'Tuin
2021-02-13 05:55:53 -07:00
</h1>
<blockquote align="center">
Through the fathomless deeps of space swims the star turtle Great ATuin, bearing on its back the four giant elephants who carry on their shoulders the mass of the Discworld.
</blockquote>
2021-02-14 09:23:08 -07:00
<p align="center">
<a href="https://github.com/ellie/atuin/actions?query=workflow%3ARust"><img src="https://img.shields.io/github/workflow/status/ellie/atuin/Rust?style=flat-square" /></a>
<a href="https://crates.io/crates/atuin"><img src="https://img.shields.io/crates/v/atuin.svg?style=flat-square" /></a>
<a href="https://crates.io/crates/atuin"><img src="https://img.shields.io/crates/d/atuin.svg?style=flat-square" /></a>
<a href="https://github.com/ellie/atuin/blob/main/LICENSE"><img src="https://img.shields.io/crates/l/atuin.svg?style=flat-square" /></a>
</p>
2021-02-13 05:55:53 -07:00
A'Tuin manages and synchronizes your shell history! Instead of storing
everything in a text file (such as ~/.history), A'Tuin uses a sqlite database.
2021-02-13 14:21:00 -07:00
While being a little more complex, this allows for more functionality.
2021-02-13 13:21:49 -07:00
As well as the expected command, A'Tuin stores
2021-02-13 13:21:49 -07:00
- duration
- exit code
- working directory
- hostname
- time
- a unique session ID
2021-02-13 13:54:35 -07:00
## Supported Shells
- zsh
2021-02-13 13:54:35 -07:00
## Install
2021-02-14 16:33:14 -07:00
### AUR
A'Tuin is available on the [AUR](https://aur.archlinux.org/packages/atuin/)
2021-02-14 16:33:14 -07:00
```
yay -S atuin # or your AUR helper of choice
```
### With cargo
2021-02-14 11:20:18 -07:00
`atuin` needs a nightly version of Rust + Cargo! It's best to use
2021-02-13 14:21:00 -07:00
[rustup](https://rustup.rs/) for getting set up there.
2021-02-13 13:54:35 -07:00
2021-02-14 11:20:18 -07:00
```
rustup default nightly
2021-02-14 16:33:14 -07:00
cargo install atuin
2021-02-14 11:20:18 -07:00
```
2021-02-14 16:33:14 -07:00
### From source
2021-02-13 13:54:35 -07:00
```
2021-02-14 16:33:14 -07:00
rustup default nightly
git clone https://github.com/ellie/atuin.git
cd atuin
cargo install --path .
2021-02-13 13:54:35 -07:00
```
2021-02-14 16:33:14 -07:00
### Shell plugin
2021-02-13 13:54:35 -07:00
Once the binary is installed, the shell plugin requires installing. Add
2021-02-13 13:54:35 -07:00
2021-02-13 14:21:00 -07:00
```
eval "$(atuin init)"
2021-02-13 14:21:00 -07:00
```
2021-02-13 13:54:35 -07:00
to your `.zshrc`/`.bashrc`/whatever your shell uses.
2021-02-13 13:54:35 -07:00
## Usage
### History search
By default A'Tuin will rebind ctrl-r and the up arrow to search your history.
2021-03-19 18:50:31 -06:00
You can prevent this by putting
```
export ATUIN_BINDKEYS="false"
```
into your shell config.
2021-02-13 13:54:35 -07:00
### Import history
```
atuin import auto # detect shell, then import
or
2021-02-13 13:54:35 -07:00
atuin import zsh # specify shell
```
### List history
List all history
2021-02-13 13:54:35 -07:00
```
atuin history list
```
2021-02-13 14:21:00 -07:00
List history for the current directory
```
atuin history list --cwd
atuin h l -c # alternative, shorter version
```
List history for the current session
```
atuin history list --session
atuin h l -s # similarly short
```
2021-02-14 15:47:22 -07:00
### Stats
A'Tuin can calculate statistics for a single day, and accepts "natural language" style date input, as well as absolute dates:
2021-02-14 15:47:22 -07:00
```
$ atuin stats day last friday
+---------------------+------------+
| Statistic | Value |
+---------------------+------------+
| Most used command | git status |
+---------------------+------------+
| Commands ran | 450 |
+---------------------+------------+
| Unique commands ran | 213 |
+---------------------+------------+
$ atuin stats day 01/01/21 # also accepts absolute dates
```
It can also calculate statistics for all of known history:
```
$ atuin stats all
+---------------------+-------+
| Statistic | Value |
+---------------------+-------+
| Most used command | ls |
+---------------------+-------+
| Commands ran | 8190 |
+---------------------+-------+
| Unique commands ran | 2996 |
+---------------------+-------+
```
2021-03-10 14:24:08 -07:00
## Config
A'Tuin is configurable via TOML. The file lives at ` ~/.config/atuin/config.toml`,
2021-03-10 14:24:08 -07:00
and looks like this:
```
[local]
dialect = "uk" # or us. sets the date format used by stats
server_address = "https://atuin.elliehuxtable.com/" # the server to sync with
[local.db]
path = "~/.local/share/atuin/history.db" # the local database for history
```
2021-02-13 14:21:00 -07:00
## ...what's with the name?
A'Tuin is named after "The Great A'Tuin", a giant turtle from Terry Pratchett's
2021-02-13 14:21:00 -07:00
Discworld series of books.