mod config;
mod copy;
mod drag;
mod init;
mod menu;
mod scroll;
mod state;
mod status;
mod util;
mod watch;
use anyhow::Result;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(name = "glance", about = "A file clipboard for Wayland")]
struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
Watch,
Status {
#[arg(long)]
index: Option<usize>,
},
Copy,
Drag,
Menu,
Scroll {
direction: String,
},
Init,
}
fn main() -> Result<()> {
let cli = Cli::parse();
if matches!(cli.command, Commands::Init) {
return init::run();
}
let cfg = config::Config::load()?;
match cli.command {
Commands::Watch => watch::run(&cfg),
Commands::Status { index } => status::run(&cfg, index),
Commands::Copy => copy::run(&cfg),
Commands::Drag => drag::run(&cfg),
Commands::Menu => menu::run(&cfg),
Commands::Scroll { ref direction } => scroll::run(&cfg, direction),
Commands::Init => unreachable!(),
}
}