mirror of
https://github.com/PR0M3TH3AN/Marlin.git
synced 2025-09-09 23:58:42 +00:00
updated CLI
This commit is contained in:
81
src/cli.rs
81
src/cli.rs
@@ -1,15 +1,36 @@
|
||||
// src/cli.rs
|
||||
use std::path::PathBuf;
|
||||
use clap::{Parser, Subcommand};
|
||||
pub mod link;
|
||||
pub mod coll;
|
||||
pub mod view;
|
||||
pub mod state;
|
||||
pub mod task;
|
||||
pub mod remind;
|
||||
pub mod annotate;
|
||||
pub mod version;
|
||||
pub mod event;
|
||||
|
||||
use clap::{Parser, Subcommand, ArgEnum, Args, CommandFactory};
|
||||
use clap_complete::Shell;
|
||||
|
||||
/// Output format for commands.
|
||||
#[derive(ArgEnum, Clone, Copy, Debug)]
|
||||
pub enum Format {
|
||||
Text,
|
||||
Json,
|
||||
}
|
||||
|
||||
/// Marlin – metadata-driven file explorer (CLI utilities)
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(author, version, about)]
|
||||
#[command(author, version, about, propagate_version = true)]
|
||||
pub struct Cli {
|
||||
/// Enable debug logging and extra output
|
||||
#[arg(long)]
|
||||
pub verbose: bool,
|
||||
|
||||
/// Output format (text or JSON)
|
||||
#[arg(long, default_value = "text", value_enum, global = true)]
|
||||
pub format: Format,
|
||||
|
||||
#[command(subcommand)]
|
||||
pub command: Commands,
|
||||
}
|
||||
@@ -21,12 +42,15 @@ pub enum Commands {
|
||||
|
||||
/// Scan one or more directories and populate the file index
|
||||
Scan {
|
||||
paths: Vec<PathBuf>,
|
||||
/// Directories to scan (defaults to cwd)
|
||||
paths: Vec<std::path::PathBuf>,
|
||||
},
|
||||
|
||||
/// Tag files matching a glob pattern (hierarchical tags use `/`)
|
||||
Tag {
|
||||
/// Glob or path pattern
|
||||
pattern: String,
|
||||
/// Hierarchical tag name (`foo/bar`)
|
||||
tag_path: String,
|
||||
},
|
||||
|
||||
@@ -46,14 +70,57 @@ pub enum Commands {
|
||||
/// Create a timestamped backup of the database
|
||||
Backup,
|
||||
|
||||
/// Restore from a backup file (over-writes current DB)
|
||||
/// Restore from a backup file (overwrites current DB)
|
||||
Restore {
|
||||
backup_path: PathBuf,
|
||||
backup_path: std::path::PathBuf,
|
||||
},
|
||||
|
||||
/// Generate shell completions (hidden)
|
||||
#[command(hide = true)]
|
||||
Completions {
|
||||
#[arg(value_enum)]
|
||||
shell: Shell,
|
||||
},
|
||||
|
||||
/// File-to-file links
|
||||
#[command(subcommand)]
|
||||
Link { cmd: link::LinkCmd },
|
||||
|
||||
/// Collections (groups) of files
|
||||
#[command(subcommand)]
|
||||
Coll { cmd: coll::CollCmd },
|
||||
|
||||
/// Smart views (saved queries)
|
||||
#[command(subcommand)]
|
||||
View { cmd: view::ViewCmd },
|
||||
|
||||
/// Workflow states on files
|
||||
#[command(subcommand)]
|
||||
State { cmd: state::StateCmd },
|
||||
|
||||
/// TODO/tasks management
|
||||
#[command(subcommand)]
|
||||
Task { cmd: task::TaskCmd },
|
||||
|
||||
/// Reminders on files
|
||||
#[command(subcommand)]
|
||||
Remind { cmd: remind::RemindCmd },
|
||||
|
||||
/// File annotations and highlights
|
||||
#[command(subcommand)]
|
||||
Annotate { cmd: annotate::AnnotateCmd },
|
||||
|
||||
/// Version diffs
|
||||
#[command(subcommand)]
|
||||
Version { cmd: version::VersionCmd },
|
||||
|
||||
/// Calendar events & timelines
|
||||
#[command(subcommand)]
|
||||
Event { cmd: event::EventCmd },
|
||||
}
|
||||
|
||||
#[derive(Subcommand, Debug)]
|
||||
pub enum AttrCmd {
|
||||
Set { pattern: String, key: String, value: String },
|
||||
Ls { path: PathBuf },
|
||||
Ls { path: std::path::PathBuf },
|
||||
}
|
||||
|
Reference in New Issue
Block a user