archiver-ts 0.0.8 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,8 +20,6 @@ Archive / restore:
20
20
  arv put <items...> [-v|--vault <vault>] [-m|--message <msg>] [-r|--remark <remark>]
21
21
  arv restore <ids...>
22
22
  arv move <ids...> --to <vault>
23
- arv cd <archive-id | vault/archive-id> [--print]
24
- arv cd - [--print]
25
23
  ```
26
24
 
27
25
  Vault management:
@@ -38,43 +36,92 @@ arv vault list [-a|--all]
38
36
  Query and maintenance:
39
37
 
40
38
  ```bash
41
- arv list [--restored] [--all] [--vault <vault>] [--no-interactive]
39
+ arv list [--restored] [--all] [--vault <vault>] [--no-interactive] [--plain]
42
40
  arv log [YYYYMM | YYYYMM-YYYYMM | all]
43
41
  arv log --id <log-id>
44
42
  arv config list [-c|--comment]
45
43
  arv config alias <alias=path> [-r|--remove]
46
44
  arv config update-check <on|off>
47
45
  arv config vault-item-sep <separator>
46
+ arv config style <on|off>
47
+ arv config language <zh|en>
48
+ arv config no-command-action <help|list|unknown>
48
49
  arv update [--repo <owner/repo>] [--install]
49
50
  arv check
50
51
  ```
51
52
 
53
+ `arv log` without range now prints all records by default (grep-friendly).
54
+
52
55
  ## List output behavior
53
56
 
54
- `arv list` plain mode prints one entry per line:
57
+ `arv list` default non-interactive output is one line per entry:
55
58
 
56
59
  - format: `[<archiveId>] <A|R> <display-name>`
60
+ - `<archiveId>` is zero-padded to 4 digits
57
61
  - default vault (`@`, id `0`): `<display-name>` is item name only
58
62
  - non-default vault: `<display-name>` is `<vaultName>(<vaultId>)<sep><item>`
59
63
  - `<sep>` comes from `config vault-item-sep` (default `::`)
60
64
 
61
- Example:
65
+ Use `arv list --plain` for grep/script usage:
66
+
67
+ - format: `<archiveId><TAB><A|R><TAB><display-name>`
68
+ - always disables interactive picker
69
+ - prints no extra hints/messages when no entries match
70
+
71
+ Examples:
62
72
 
63
73
  ```text
64
74
  [0001] A todo.txt
65
75
  [0002] A work(1)::report.pdf
76
+ 1 A todo.txt
77
+ 2 A work(1)::report.pdf
66
78
  ```
67
79
 
68
80
  ## Shell wrapper note
69
81
 
70
- On interactive terminal startup, `arv` may auto-install a shell wrapper function so `cd` can move your shell to archive slot paths.
82
+ On interactive terminal startup, `arv` may auto-install a shell wrapper function so `arv list` interactive `Enter slot` can move your shell to archive slot paths.
83
+
84
+ Use project-prefixed env overrides when needed:
85
+
86
+ ```bash
87
+ ARCHIVER_DISABLE_SHELL_INIT=1 arv <command>
88
+ ARCHIVER_STYLE=off arv list
89
+ ```
90
+
91
+ ## No-command behavior
92
+
93
+ When you run `arv` without any subcommand, behavior is controlled by config:
71
94
 
72
- Disable this behavior if needed:
95
+ - `unknown` (default): ask once (list/help) and save to config
96
+ - `help`: show help text
97
+ - `list`: run `arv list`
98
+
99
+ If `no_command_action` is `unknown` and input is not TTY (e.g. piped/CI), `arv` falls back to help text for that run.
100
+
101
+ Set it with:
73
102
 
74
103
  ```bash
75
- ARV_DISABLE_SHELL_INIT=1 arv <command>
104
+ arv config no-command-action unknown
105
+ arv config no-command-action help
106
+ arv config no-command-action list
76
107
  ```
77
108
 
109
+ ## Language
110
+
111
+ - default language is `zh`
112
+ - switch language with:
113
+
114
+ ```bash
115
+ arv config language zh
116
+ arv config language en
117
+ ```
118
+
119
+ ## JSONC defaults and comments
120
+
121
+ - `config.jsonc` and `auto-incr.jsonc` are initialized from `public/config.default.jsonc` and `public/auto-incr.default.jsonc`.
122
+ - Build keeps these default JSONC files and copies them into `dist/` as-is.
123
+ - Saving config/auto-incr updates values while preserving existing JSONC comments.
124
+
78
125
  ## Useful aliases
79
126
 
80
127
  - `list`: `l`, `ls`
@@ -0,0 +1,7 @@
1
+ // 各个实体的自增 ID,存储于此
2
+ // This file stores the auto-incrementing IDs for various entities.
3
+ {
4
+ "logId": 0,
5
+ "vaultId": 0,
6
+ "archiveId": 0,
7
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ // 当前使用的 vault ID,默认为 0,表示默认 vault
3
+ // The currently active vault ID, default is 0 which represents the default vault
4
+ "currentVaultId": 0,
5
+
6
+ // 是否检查更新,默认为 "on"
7
+ // Whether to check for updates, default is "on"
8
+ "updateCheck": "on", // "on" | "off"
9
+
10
+ // 记录上一次检查更新的时间
11
+ // Records the last time updates were checked
12
+ "lastUpdateCheck": "",
13
+
14
+ "aliasMap": {},
15
+
16
+ // 开启后,控制台会输出彩色的、有样式的文字,更美观
17
+ // When turned on, the console will output colorful and styled text for better aesthetics
18
+ "style": "on", // "on" | "off"
19
+
20
+ // 语言设置,默认中文
21
+ // UI language, default is Chinese
22
+ "language": "zh", // "zh" | "en"
23
+
24
+ // 在arv list 命令下,vault 中条目的分隔符,默认为 "::"
25
+ // The separator for items in the vault, default is "::"
26
+ "vaultItemSeparator": "::",
27
+
28
+ // 配置只输入arv,没有子命令的时候的行为
29
+ // Configures the behavior when only "arv" is entered without a subcommand
30
+ "noCommandAction": "unknown", // "unknown" | "help" | "list"
31
+ }