Skip to content

Commit cee6dca

Browse files
authored
feat: add compact command (#174)
1 parent a17fb70 commit cee6dca

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

cliphist.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var version string
3636
func main() {
3737
flag.Usage = func() {
3838
fmt.Fprintf(flag.CommandLine.Output(), "usage:\n")
39-
fmt.Fprintf(flag.CommandLine.Output(), " $ %s <store|list|decode|delete|delete-query|wipe|version>\n", flag.CommandLine.Name())
39+
fmt.Fprintf(flag.CommandLine.Output(), " $ %s <store|list|decode|delete|delete-query|wipe|compact|version>\n", flag.CommandLine.Name())
4040
fmt.Fprintf(flag.CommandLine.Output(), "options:\n")
4141
flag.VisitAll(func(f *flag.Flag) {
4242
fmt.Fprintf(flag.CommandLine.Output(), " -%s (default %s)\n", f.Name, f.DefValue)
@@ -92,6 +92,8 @@ func main() {
9292
err = delete(*dbPath, os.Stdin)
9393
case "wipe":
9494
err = wipeAndCompact(*dbPath)
95+
case "compact":
96+
err = compactDB(*dbPath)
9597
case "version":
9698
fmt.Fprintf(flag.CommandLine.Output(), "%s\t%s\n", "version", strings.TrimSpace(version))
9799
flag.VisitAll(func(f *flag.Flag) {

readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ Or else query manually:
4545

4646
`$ cliphist wipe`.
4747

48+
#### Compact database
49+
50+
`$ cliphist compact`.
51+
4852
---
4953

5054
### Picker examples

0 commit comments

Comments
 (0)