Commit graph

27 commits

Author SHA1 Message Date
a41d72fb6b
stash: refactor error handling and entry deduplication
This includes breaking changes to the database entries, where we have
started deduplicating based on hashes instead of full entries. Entry
collisions are possible, but highly unlikely.

Additionally we use `Box<str>` for error variants to reduce allocations.
This is *yet* to give me a non-marginal performance benefit but doesn't
hurt to be more correct.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964d0a33392da61372214ca3088551564ac
2025-09-19 14:08:15 +03:00
36c183742d
stash: blocking persistent entries by window class
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964061bd97b4ffc4e84d835072331a966c6
2025-09-19 11:22:58 +03:00
ae98cc0b86
stash: replace atty with is_terminal from std::io
It's deprecated, oops.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69646dc5a20ff1fde23ea9a846a7a3fdd16a
2025-08-20 18:38:04 +03:00
b1a220400d
stash: add help text for cliphist compat flags
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964aa5c4ab66d13fe6e0d38400cdde5de1a
2025-08-20 11:06:53 +03:00
1ed518a3b6
stash: move import logic into stash::commmands
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964f8fb8c9b14049ba3a343bb453ca59004
2025-08-20 11:06:52 +03:00
f39937d3ca
stash: import all entries by default; log if db import fails
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964804698d2e83a37ec2688e9c126cf412b
2025-08-20 09:57:45 +03:00
6a5cd9b95d
treewide: format with rustfmt
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69642c2865f41a4b141ddf39a198a3fc2e09
2025-08-20 09:57:44 +03:00
83d45c6414
list: if we're in a TTY, output data in a TUI
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a696493f2e7ca911b6c1e2692b67f357a4b6b
2025-08-15 08:04:24 +03:00
0547376a9e
chore: apply clippy fixes; suppress "too many lines" lint
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a696476135218b9979677c66c4be4d96aced8
2025-08-14 17:31:26 +03:00
86001652cd
stash: allow confirming destructive operations with --ask
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69644c23734a8b088e20473d381390d532b4
2025-08-14 17:24:01 +03:00
64c923480e
decode: fallback to relaying current clipboard to stdout on failure
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a696451def3e367afa9e8b0dd6ae626906e53
2025-08-13 18:46:02 +03:00
db6a962c75
stash: create database directory automatically if missing
Oops.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964866a1711971322c81ea194aa062466da
2025-08-13 17:07:06 +03:00
9d40dde63a
commands/watch: make it trait-based; move out of main
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964c16396f2013e7f8a5c1a6c0c3bb2aeaa
2025-08-12 22:57:20 +03:00
5bcc23b6f9
stash: don't initialize watch daemon with None
Fixes the daemon always updating the latest entry.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a696489a2e9a0928ff799a4210c160014c485
2025-08-12 21:53:59 +03:00
6c5408abd1
stash: make watch loop async
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69641a4f39f0368de1bcf5780afbe8e5c0b1
2025-08-12 21:53:47 +03:00
fcaf5fb14f
stash: print --help text if no subcommand is provided
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69646361b7ade52ee73a6aa11be859132a94
2025-08-12 19:21:13 +03:00
4f725425fc
db: switch to sqlite as the primary backend
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69648f81d0d094e11a3e0f0a19d3b8eccd5d
2025-08-12 19:07:38 +03:00
efcbe17d73
stash: add watch subcommand
Watches primary clipboard for changes and stores them in the database.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964de9949bbe6d8b9301ca97ae785852b46
2025-08-12 19:07:26 +03:00
7ebe514e3a
stash: deduplicate error reporting
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964f0f3f13190dde392fc859718716b56a8
2025-08-12 17:34:42 +03:00
6e21021306
treewide: improve logging; custom error types with thiserror
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a696464e4123d15cfaedf4727776e55948369
2025-08-12 17:34:41 +03:00
c23c5af8c1
stash: allow controlling verbosity from the command line
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69641d5d727b1d95f8c9e2b851b3a194315a
2025-08-12 17:34:39 +03:00
d8d27fab22
stash: remove redundant log messages
Ported from print-based logging, now redundant

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964c1ba52c792bd3c2a3e15a97a3b03260e
2025-08-12 17:34:38 +03:00
0e4f4018ab
stash: use more granular STASH_CLIPBOARD_STATE
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964d59d2ce974ba482aee9b1c8f20cdb44e
2025-08-12 17:34:37 +03:00
0c8003d636
stash: remove redundant import flag
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964348f1ad4915890f0b4ccd59619cc3e1a
2025-08-12 17:34:36 +03:00
254c288111
treewide: improve logging; get rid of unwrap()s
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a696442ff25c3f65bb2d5f68e0d78a569fd76
2025-08-12 15:03:41 +03:00
b0820a1940
modularize codebase
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69648ea836bfeb539450db14a666c623412e
2025-08-12 15:01:32 +03:00
e2c10f386f
first working prototype
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964dedc7f122b26b0e2e5040248b7866c93
2025-08-12 15:01:28 +03:00