1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
use clap::{Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(name = "aphid", version, about, long_about = None)]
pub struct Cli {
#[arg(short, long, default_value = "aphid.toml", global = true)]
pub config: PathBuf,
#[command(subcommand)]
pub command: Option<Command>,
}
#[derive(Subcommand)]
pub enum Command {
Build {
/// Output directory for the rendered site.
#[arg(short, long, default_value = "dist")]
output: PathBuf,
},
Serve {
#[arg(short, long, default_value_t = 3000)]
port: u16,
},
/// Create a new aphid site in a new directory.
New {
/// Name of the directory to create.
name: String,
},
/// Initialize an aphid site in the current directory.
Init {
/// Directory to initialize (defaults to current directory).
path: Option<PathBuf>,
},
/// Manage blog posts.
Blog {
#[command(subcommand)]
action: BlogAction,
},
/// Manage wiki pages.
Wiki {
#[command(subcommand)]
action: WikiAction,
},
/// Manage standalone pages.
Page {
#[command(subcommand)]
action: PageAction,
},
}
#[derive(Subcommand)]
pub enum BlogAction {
/// Create a new blog post.
New {
/// Title of the blog post.
title: String,
},
}
#[derive(Subcommand)]
pub enum WikiAction {
/// Create a new wiki page.
New {
/// Title of the wiki page.
title: String,
},
}
#[derive(Subcommand)]
pub enum PageAction {
/// Create a new standalone page.
New {
/// Title of the page.
title: String,
},
}