aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/README.md
blob: 2177ad698006c5c2061c42f9e922b15ca199d95a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Soon

[![Publish to AUR](https://github.com/HsiangNianian/soon/actions/workflows/publish-aur.yml/badge.svg)](https://github.com/HsiangNianian/soon/actions/workflows/publish-aur.yml)
[![Publish to crates.io](https://github.com/HsiangNianian/soon/actions/workflows/publish-crates.yml/badge.svg)](https://github.com/HsiangNianian/soon/actions/workflows/publish-crates.yml)
[![Publish to PyPI](https://github.com/HsiangNianian/soon/actions/workflows/publish-pypi.yml/badge.svg)](https://github.com/HsiangNianian/soon/actions/workflows/publish-pypi.yml)


> ๐Ÿค– Predict your next shell command based on history โ€” like shell autocomplete, but MORE stupid

<img align="right" src="https://repology.org/badge/vertical-allrepos/soon.svg?columns=2" />

- ๐Ÿš Shell-aware (supports Bash, Zsh, Fish)
- ๐Ÿ“Š Shows your most used commands and analyzes patterns
- ๐Ÿง  Smart learning from command history
- ๐Ÿ”„ Easy update management and version checking
- ๐ŸŒ i18n support (EN/ไธญๆ–‡) (WIP)
- ๐Ÿ’ก Designed for clarity โ€” **not** an autocomplete tool, but a prediction assistant.

![Soon](image/showcase.jpg)

## Install

1. Archlinux

```shell
paru -Sy soon
```

2. Cargo

```shell
cargo install soon
```

3. Python

```
pip install soon-bin
```

## Usage

```shell
ยปยปยปยป soon help
Predict your next shell command based on history

Usage: soon [OPTIONS] [COMMAND]

Commands:
  now                  Show the most likely next command
  stats                Show most used commands
  learn                Train prediction and analyze command patterns
  which                Display detected current shell
  version              Show version information
  update               Check for updates and show installation options
  show-cache           Show cached main commands
  show-internal-cache  Show internal cache commands
  cache                Cache a command to soon cache (for testing)
  help                 Print this message or the help of the given subcommand(s)

Options:
      --shell <SHELL>  Override shell type (bash, zsh, fish, etc.)
      --ngram <NGRAM>  Set n-gram size for prediction accuracy [default: 3]
      --debug          Enable debug output
  -h, --help           Print help
  -V, --version        Print version
```

### Main Commands

| Command               | Description                                          |
|-----------------------|------------------------------------------------------|
| `now`                 | Show the most likely next command                    |
| `stats`               | Show most used commands                              |
| `learn`               | Train prediction and analyze command patterns       |
| `which`               | Display detected current shell                       |
| `version`             | Show version information                             |
| `update`              | Check for updates and show installation options     |
| `show-cache`          | Show cached main commands                            |
| `show-internal-cache` | Show internal cache commands                         |
| `cache <NUM>`         | Set cache size to `<NUM>` and refresh cache          |
| `help`                | Print this message or the help of subcommands        |

### Options

| Option           | Description                                         |
|------------------|-----------------------------------------------------|
| `--shell <SHELL>`| Override shell type (bash, zsh, fish, etc.)        |
| `--ngram <NGRAM>`| Set n-gram size for prediction accuracy (default: 3)|
| `--debug`        | Enable debug output                                 |
| `-h, --help`     | Print help                                          |
| `-V, --version`  | Print version                                       |

---

### Examples

#### Predict your next command (default ngram=3)
```shell
soon now
```

#### Analyze your command patterns and learn insights
```shell
soon learn
```

#### Check for updates
```shell
soon update
```

#### Show your most used commands
```shell
soon stats
```

#### Show cached main commands (default ngram=3)
```shell
soon show-cache
```

#### Show cached main commands with custom cache size (e.g., 10)
```shell
soon cache 10
soon show-cache --ngram 10
```

#### Set shell type explicitly (if auto-detect fails)
```shell
soon now --shell zsh
```

#### Enable debug output
```shell
soon now --debug
```

---

### How cache works

- The `.soon_cache` file always contains the latest N main commands (N = cache size).
- Every time you run `soon now`, `soon cache <NUM>`, or `soon show-cache`, the cache is refreshed from your shell history.
- The cache size is controlled by the `<NUM>` argument in `soon cache <NUM>` or by `--ngram <NGRAM>` option.


---

MIT ยฉ 2025-PRESENT ็ฎ€ๅพ‹็บฏ.
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FHsiangNianian%2Fsoon.svg?type=shield&issueType=security)](https://app.fossa.com/projects/git%2Bgithub.com%2FHsiangNianian%2Fsoon?ref=badge_shield&issueType=security)

[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FHsiangNianian%2Fsoon.svg?type=large&issueType=license)](https://app.fossa.com/projects/git%2Bgithub.com%2FHsiangNianian%2Fsoon?ref=badge_large&issueType=license)