added the entry command

This commit is contained in:
2026-02-21 16:19:13 +01:00
parent d1040954cb
commit e84e588836
6 changed files with 225 additions and 21 deletions

View File

@@ -5,6 +5,8 @@ use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(author, version, about = "A simple wiki server/builder")]
pub struct Cli {
#[arg(short, long, global = true, default_value = ".")]
pub path: PathBuf,
#[command(subcommand)]
pub command: Commands,
}
@@ -13,8 +15,6 @@ pub struct Cli {
pub enum Commands {
/// Serve the wiki locally
Serve {
#[arg(short, long)]
path: PathBuf,
#[arg(short, long)]
no_navigation: bool,
#[arg(short = 'P', long, default_value = "8090")]
@@ -24,21 +24,39 @@ pub enum Commands {
},
/// Build the static site
Build {
#[arg(short, long)]
path: PathBuf,
#[arg(short, long)]
no_navigation: bool,
#[arg(short, long)]
out_dir: Option<PathBuf>,
},
/// Output a DOT graph of the wiki connections
Graph {
#[arg(short, long)]
path: PathBuf,
},
Graph {},
/// List broken links
Todo {
#[arg(short, long)]
path: PathBuf,
Todo {},
/// Manage wiki entries
Entry {
#[command(subcommand)]
cmd: EntryCommands,
},
}
#[derive(Subcommand)]
pub enum EntryCommands {
/// List all existing entries
List,
/// Create a new entry
New {
/// The title of the new entry (e.g. "The Great Bernardo")
name: String,
},
/// Remove an entry by its normalized name
Remove {
/// The normalized name of the toml file (e.g. "the-great-bernardo")
name: String,
},
/// Inspect the TOML config of an entry
Inspect {
/// The normalized name of the toml file (e.g. "the-great-bernardo")
name: String,
},
}