stash: add multicall support for stash-copy and stash-paste

We can finally tell the users that they can uninstall `wl-copy` and
`wl-paste` on their systems. Stash now somewhat supports being invoked
under the names `stash-copy` and `stash-paste` to fully reimplement the
functionality of `wl-copy` and `wl-paste` respectively.

A build wrapper has been added generate symlinks for `stash-copy`, `stash-paste`,
`wl-copy`, and `wl-paste`. `wl-copy` and `wl-paste` links are provided
only for backwards compatibility, but they will not go away anytime
soon.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964463b35427cb720fbab68b252944cc90c
This commit is contained in:
raf 2025-10-09 12:32:37 +03:00
commit 6496d3963d
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
4 changed files with 353 additions and 0 deletions

View file

@ -10,6 +10,7 @@ use inquire::Confirm;
mod commands;
mod db;
mod multicall;
#[cfg(feature = "use-toplevel")] mod wayland;
use crate::commands::{
@ -129,6 +130,13 @@ fn report_error<T>(
#[allow(clippy::too_many_lines)] // whatever
fn main() {
// Multicall dispatch: stash-copy, stash-paste, wl-copy, wl-paste
if crate::multicall::multicall_dispatch() {
// If handled, exit immediately
std::process::exit(0);
}
// If not multicall, proceed with normal CLI handling
smol::block_on(async {
let cli = Cli::parse();
env_logger::Builder::new()