Skip to content

Commit e6e2fad

Browse files
committed
document ins resolvething
1 parent 8451c1a commit e6e2fad

4 files changed

Lines changed: 147 additions & 0 deletions

File tree

‎docs/index.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ it if you prefer that.
1111

1212
- [Keybindings](hotkeys.md)
1313
- [ins CLI reference](ins.md)
14+
- [resolvething duplicate and Syncthing conflict cleanup](resolvething.md)
1415
- [WM configuration](wmsettings.md)
1516
- [instantwmctl reference](instantwmctl.md)
1617
- [Programs overview](programs.md)

‎docs/ins.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Some larger `ins` subcommands already have dedicated pages:
99
- [ins game](insgame.md)
1010
- [ins video](insvideo.md)
1111
- [ins assist](instantassist.md)
12+
- [ins resolvething](resolvething.md)
1213

1314
This page documents the remaining core commands that were only mentioned indirectly in the site before.
1415

@@ -19,6 +20,7 @@ The current instantCLI build exposes these main command groups:
1920
- `arch`
2021
- `dot`
2122
- `game`
23+
- `resolvething`
2224
- `doctor`
2325
- `dev`
2426
- `launch`

‎docs/resolvething.md‎

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# ins resolvething
2+
3+
`ins resolvething` helps clean up directories that are synced with Syncthing. It has two jobs:
4+
5+
- find duplicate files and move the redundant copies to trash
6+
- find Syncthing conflict files and open them next to the original file in a diff editor
7+
8+
It is designed for folders where Syncthing can leave files such as `note.sync-conflict-20240101-ABC.md` or redundant copies in `.stversions`.
9+
10+
## Quick start
11+
12+
Open the interactive menu:
13+
14+
```bash
15+
ins resolvething menu
16+
```
17+
18+
Run both cleanup steps for every configured scan directory:
19+
20+
```bash
21+
ins resolvething all
22+
```
23+
24+
Preview what would happen before changing files:
25+
26+
```bash
27+
ins resolvething all --dry-run
28+
```
29+
30+
Run against one directory without changing the saved configuration:
31+
32+
```bash
33+
ins resolvething all --dir ~/wiki/vimwiki --dry-run
34+
```
35+
36+
## Scan directories
37+
38+
`resolvething` reads its configuration from:
39+
40+
```bash
41+
~/.config/instant/resolvething.toml
42+
```
43+
44+
The default configuration scans `~/wiki/vimwiki` and treats `md` and `json` files as mergeable conflict files.
45+
46+
Use the menu to add or edit scan directories:
47+
48+
```bash
49+
ins resolvething menu
50+
```
51+
52+
Or inspect and edit the config directly:
53+
54+
```bash
55+
ins resolvething config show
56+
ins resolvething config edit
57+
```
58+
59+
Example config:
60+
61+
```toml
62+
scan_dirs = [
63+
{ path = "~/wiki/vimwiki", extensions = ["md", "json"] },
64+
{ path = "~/Documents/notes", extensions = ["txt", "md"] },
65+
]
66+
67+
# Optional. Defaults to $EDITOR, then nvim.
68+
editor_command = "nvim"
69+
```
70+
71+
`extensions` controls conflict-file handling. Use an empty list to scan all plain text files in that scan directory.
72+
73+
## Duplicate cleanup
74+
75+
```bash
76+
ins resolvething duplicates
77+
ins resolvething duplicates --dry-run
78+
ins resolvething duplicates --dir ~/wiki/vimwiki
79+
```
80+
81+
This command uses `fclones` to group identical files. Redundant files are moved to trash, not permanently deleted.
82+
83+
Some groups can be resolved automatically:
84+
85+
- conflict-file duplicates keep a non-conflict file when one exists, otherwise the newest conflict file
86+
- duplicate files inside `.stversions` keep the newest version snapshot
87+
- groups with one regular file and matching `.orig` or `.tmp` copies keep the regular file
88+
- groups made only of `.tmp` files keep one copy
89+
90+
Ambiguous groups open an interactive picker where you choose which file to keep. Use `--no-auto` to force interactive selection even for groups that are normally safe to resolve automatically.
91+
92+
Use `--show-ignored` to list duplicate groups that were deliberately skipped, such as normal live-file plus `.stversions` snapshot pairs.
93+
94+
## Syncthing conflict cleanup
95+
96+
```bash
97+
ins resolvething conflicts
98+
ins resolvething conflicts --dry-run
99+
ins resolvething conflicts --dir ~/wiki/vimwiki
100+
```
101+
102+
This command looks for Syncthing conflict filenames, reconstructs the original path, and opens both files in a diff editor. After the editor exits, `resolvething` compares the two files:
103+
104+
- if the original and conflict file now match, the conflict file is moved to trash
105+
- if they still differ, the conflict is left in place
106+
- missing, binary, or very large files are skipped
107+
108+
By default the diff editor is `$EDITOR -d`, falling back to `nvim -d`. Set `editor_command` in the config if you want a different editor command.
109+
110+
## Menu
111+
112+
```bash
113+
ins resolvething menu
114+
ins resolvething menu --gui
115+
```
116+
117+
The menu shows every configured scan directory with current duplicate and conflict counts. From there you can:
118+
119+
- resolve everything for one directory
120+
- resolve only duplicates or only conflicts
121+
- open the directory
122+
- edit the conflict extensions
123+
- change or remove the scan directory
124+
- add another scan directory
125+
126+
`--gui` opens the menu in a GUI terminal window.
127+
128+
## Command reference
129+
130+
```bash
131+
ins resolvething duplicates [--dir <path>] [--no-auto] [--show-ignored] [--dry-run]
132+
ins resolvething conflicts [--dir <path>] [--dry-run]
133+
ins resolvething all [--dir <path>] [--no-auto] [--show-ignored] [--dry-run]
134+
ins resolvething menu [--gui]
135+
ins resolvething config show
136+
ins resolvething config edit
137+
```
138+
139+
## Dependencies
140+
141+
Duplicate cleanup requires `fclones`. The interactive flows use `fzf`. If a dependency is missing, `ins` will try to install it through the supported package managers.
142+
143+
Files are moved to trash using `trash`, `gio trash`, or a fallback trash directory under the user data directory.

‎documentation.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ it if you prefer that.
3535
### Power-User Features
3636

3737
- [instantASSIST](https://instantos.io/youtube/assist)
38+
- [resolvething duplicate and Syncthing conflict cleanup](https://instantos.io/docs/resolvething)
3839
- [quickmenu](https://instantos.io/youtube/quickmenu)
3940
- [visibility options](https://instantos.io/youtube/visibility)
4041
- [customizing](https://instantos.io/youtube/customize)

0 commit comments

Comments
 (0)