Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<em>exit code, duration, time and command shown</em>
</p>

[English] | [简体中文]

Atuin replaces your existing shell history with a SQLite database, and records
additional context for your commands. Additionally, it provides optional and
_fully encrypted_ synchronisation of your history between machines, via an Atuin
Expand Down Expand Up @@ -195,3 +197,6 @@ to your `is-interactive` block in your `~/.config/fish/config.fish` file

Atuin is named after "The Great A'Tuin", a giant turtle from Terry Pratchett's
Discworld series of books.

[English]: ./README.md
[简体中文]: ./docs/zh-CN/README.md
2 changes: 1 addition & 1 deletion docs/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Defaults to `127.0.0.1`.

### port

The post the atuin server should listen on.
The port the atuin server should listen on.

Defaults to `8888`.

Expand Down
195 changes: 195 additions & 0 deletions docs/zh-CN/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
<h1 align="center">
Atuin
</h1>

<p align="center">
<em>神奇的 shell 历史记录</em>
</p>

<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>
<a href="https://discord.gg/Fq8bJSKPHh"><img src="https://img.shields.io/discord/954121165239115808" /></a>
</p>

<p align="center">
<img src="../../demo.gif" alt="animated" width="80%" />
</p>

<p align="center">
<em>显示退出代码、命令持续时间、上次执行时间和执行的命令</em>
</p>

[English] | [简体中文]

Atuin 使用 SQLite 数据库取代了你现有的 shell 历史,并为你的命令记录了额外的内容。此外,它还通过 Atuin 服务器,在机器之间提供可选的、完全加密的历史记录同步功能。


除了搜索 UI,它还可以执行以下操作:

```
# 搜索昨天下午3点之后记录的所有成功的 `make` 命令
atuin search --exit 0 --after "yesterday 3pm" make
```

你可以使用我(ellie)托管的服务器,也可以使用你自己的服务器!或者干脆不使用 sync 功能。所有的历史记录同步都是加密,即使我想,也无法访问你的数据。且我**真的**不想。

## 特点

- 重新绑定 `up` 和 `ctrl-r` 的全屏历史记录搜索UI界面
- 使用 sqlite 数据库存储 shell 历史记录
- 备份以及同步已加密的 shell 历史记录
- 在不同的终端、不同的会话以及不同的机器上都有相同的历史记录
- 记录退出代码、cwd、主机名、会话、命令持续时间,等等。
- 计算统计数据,如 "最常用的命令"。
- 不替换旧的历史文件
- 通过 <kbd>Alt-\<num\></kbd> 快捷键快速跳转到之前的记录
- 通过 ctrl-r 切换过滤模式;可以仅从当前会话、目录或全局来搜索历史记录

## 文档

- [快速开始](#快速开始)
- [安装](#安装)
- [导入](./import.md)
- [配置](./config.md)
- [历史记录搜索](./search.md)
- [历史记录云端同步](./sync.md)
- [历史记录统计](./stats.md)
- [运行你自己的服务器](./server.md)
- [键绑定](./key-binding.md)
- [shell补全](./shell-completions.md)

## 支持的 Shells

- zsh
- bas
- fish

## 社区

Atuin 有一个 Discord 社区, 可以在 [这里](https://discord.gg/Fq8bJSKPHh) 获得

# 快速开始

## 使用默认的同步服务器

这将为您注册由我托管的默认同步服务器。 一切都是端到端加密的,所以你的秘密是安全的!

阅读下面的更多信息,了解仅供离线使用或托管您自己的服务器。

```
bash <(curl https://raw.githubusercontent.com/ellie/atuin/main/install.sh)

atuin register -u <USERNAME> -e <EMAIL> -p <PASSWORD>
atuin import auto
atuin sync
```

## 仅离线 (不同步)

```
bash <(curl https://raw.githubusercontent.com/ellie/atuin/main/install.sh)

atuin import auto
```

## 安装

### 脚本 (推荐)

安装脚本将帮助您完成设置,确保您的 shell 正确配置。 它还将使用以下方法之一,在可能的情况下首选系统包管理器(pacman、homebrew 等)。

```
# 不要以root身份运行,如果需要的话,会要求root。
bash <(curl https://raw.githubusercontent.com/ellie/atuin/main/install.sh)
```

### 使用cargo

最好使用 [rustup](https://rustup.rs/) 来设置 Rust 工具链,然后你就可以运行下面的命令:

```
cargo install atuin
```

### Homebrew

```
brew install atuin
```

### MacPorts

Atuin 也可以在 [MacPorts](https://ports.macports.org/port/atuin/) 中找到

```
sudo port install atuin
```

### Pacman

Atuin 在 Arch Linux 的 [社区存储库](https://archlinux.org/packages/community/x86_64/atuin/) 中可用。

```
pacman -S atuin
```

### 从源码编译安装

```
git clone https://github.com/ellie/atuin.git
cd atuin
cargo install --path .
```

## Shell 插件

安装二进制文件后,需要安装 shell 插件。
如果你使用的是脚本安装,那么这一切应该都会帮您完成!

### zsh

```
echo 'eval "$(atuin init zsh)"' >> ~/.zshrc
```

或使用插件管理器:

```
zinit load ellie/atuin
```

### bash

我们需要设置一些钩子(hooks), 所以首先需要安装 bash-preexec :

```
curl https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -o ~/.bash-preexec.sh
echo '[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh' >> ~/.bashrc
```

然后设置Atuin

```
echo 'eval "$(atuin init bash)"' >> ~/.bashrc
```

### fish

添加

```
atuin init fish | source
```

到 ~/.config/fish/config.fish 文件中的 is-interactive 块中

## ...这个名字是什么意思?

Atuin 以 "The Great A'Tuin" 命名, 这是一只来自 Terry Pratchett 的 Discworld 系列书籍的巨龟。


[English]: ../../README.md
[简体中文]: ./README.md
137 changes: 137 additions & 0 deletions docs/zh-CN/config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# 配置

Atuin 维护两个配置文件,存储在 `~/.config/atuin/` 中。 我们将数据存储在 `~/.local/share/atuin` 中(除非被 XDG\_\* 覆盖)。

您可以通过设置更改配置目录的路径 `ATUIN_CONFIG_DIR`。 例如

```
export ATUIN_CONFIG_DIR = /home/ellie/.atuin
```

## 客户端配置

```
~/.config/atuin/config.toml
```

客户端运行在用户的机器上,除非你运行的是服务器,否则这就是你所关心的。

见 [config.toml](../../atuin-client/config.toml) 中的例子

### `dialect`

这配置了 [stats](stats.md) 命令解析日期的方式。 它有两个可能的值

```
dialect = "uk"
```

或者

```
dialect = "us"
```

默认为 "us".

### `auto_sync`

配置登录时是否自动同步。默认为 true

```
auto_sync = true/false
```

### `sync_address`

同步的服务器地址! 默认为 `https://api.atuin.sh`

```
sync_address = "https://api.atuin.sh"
```

### `sync_frequency`

多长时间与服务器自动同步一次。这可以用一种"人类可读"的格式给出。例如,`10s`,`20m`,`1h`,等等。默认为 `1h` 。

如果设置为 `0`,Atuin将在每个命令之后进行同步。一些服务器可能有潜在的速率限制,这不会造成任何问题。

```
sync_frequency = "1h"
```

### `db_path`

Atuin SQlite数据库的路径。默认为
`~/.local/share/atuin/history.db`

```
db_path = "~/.history.db"
```

### `key_path`

Atuin加密密钥的路径。默认为
`~/.local/share/atuin/key`

```
key = "~/.atuin-key"
```

### `session_path`

Atuin服务器会话文件的路径。默认为
`~/.local/share/atuin/session` 。 这本质上只是一个API令牌

```
key = "~/.atuin-session"
```

### `search_mode`

使用哪种搜索模式。Atuin 支持 "prefix"(前缀)、"fulltext"(全文) 和 "fuzzy"(模糊)搜索模式。前缀(prefix)搜索语法为 "query\*",全文(full text)搜索语法为 "\*query\*",而模糊搜索适用的搜索语法 [如下所述](#fuzzy-search-syntax) 。

默认配置为 "prefix"

### `filter_mode`

搜索时要使用的默认过滤器

| 模式 | 描述 |
|--------------- | --------------- |
| global (default) | 从所有主机、所有会话、所有目录中搜索历史记录 |
| host | 仅从该主机搜索历史记录 |
| session | 仅从当前会话中搜索历史记录 |
| directory | 仅从当前目录搜索历史记录|

过滤模式仍然可以通过 ctrl-r 来切换


```
search_mode = "fulltext"
```

#### `fuzzy` 的搜索语法

`fuzzy` 搜索语法的基础是 [fzf 搜索语法](https://github.com/junegunn/fzf#search-syntax) 。

| 内容 | 匹配类型 | 描述 |
| --------- | -------------------------- | ------------------------------------ |
| `sbtrkt` | fuzzy-match | 匹配 `sbtrkt` 的项目 |
| `'wild` | exact-match (quoted) | 包含 `wild` 的项目 |
| `^music` | prefix-exact-match | 以 `music` 开头的项目 |
| `.mp3$` | suffix-exact-match | 以 `.mp3` 结尾的项目 |
| `!fire` | inverse-exact-match | 不包括 `fire` 的项目 |
| `!^music` | inverse-prefix-exact-match | 不以 `music` 开头的项目 |
| `!.mp3$` | inverse-suffix-exact-match | 不以 `.mp3` 结尾的项目 |


单个条形字符术语充当 OR 运算符。 例如,以下查询匹配以 `core` 开头并以 `go`、`rb` 或 `py` 结尾的条目。

```
^core go$ | rb$ | py$
```

## 服务端配置

`// TODO`
25 changes: 25 additions & 0 deletions docs/zh-CN/import.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# `atuin import`

Atuin 可以从您的“旧”历史文件中导入您的历史记录

`atuin import auto` 将尝试找出你的 shell(通过 \$SHELL)并运行正确的导入器

不幸的是,这些旧文件没有像 Atuin 那样存储尽可能多的信息,因此并非所有功能都可用于导入的数据。

# zsh

```
atuin import zsh
```

如果你设置了 HISTFILE,这应该会被选中!如果没有,可以尝试以下操作

```
HISTFILE=/path/to/history/file atuin import zsh
```

这支持简单和扩展形式

# bash

TODO
Loading