-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcli.rs
More file actions
108 lines (104 loc) · 3.94 KB
/
cli.rs
File metadata and controls
108 lines (104 loc) · 3.94 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
use clap::{Parser, Subcommand};
use std::path::PathBuf;
/// CLI structure for foc-devnet
#[derive(Parser)]
#[command(name = "foc-devnet")]
#[command(about = "CLI for managing local filecoin-onchain-cloud cluster")]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
/// Available subcommands
#[derive(Subcommand)]
pub enum Commands {
/// Start the local cluster
Start {
/// Run steps in parallel where possible (experimental)
#[arg(long)]
parallel: bool,
},
/// Stop the local cluster
Stop,
/// Initialize foc-devnet by building and caching Docker images
Init {
/// Curio source location.
/// Latest tag: 'latesttag' (newest), 'latesttag:<selector>' (e.g. 'latesttag:pdp/v*'),
/// 'latesttag:<url>:<selector>' (custom repo). Resolved once at init.
/// Explicit: 'gittag:<tag>', 'gittag:<url>:<tag>', 'gitcommit:<sha>',
/// 'gitcommit:<url>:<sha>', 'gitbranch:<branch>', 'gitbranch:<url>:<branch>',
/// 'local:/path/to/curio'.
#[arg(long)]
curio: Option<String>,
/// Lotus source location.
/// Latest tag: 'latesttag' (newest), 'latesttag:<selector>' (e.g. 'latesttag:v*'),
/// 'latesttag:<url>:<selector>' (custom repo). Resolved once at init.
/// Explicit: 'gittag:<tag>', 'gittag:<url>:<tag>', 'gitcommit:<sha>',
/// 'gitcommit:<url>:<sha>', 'gitbranch:<branch>', 'gitbranch:<url>:<branch>',
/// 'local:/path/to/lotus'.
#[arg(long)]
lotus: Option<String>,
/// Filecoin Services source location.
/// Latest tag: 'latesttag' (newest), 'latesttag:<selector>' (e.g. 'latesttag:v*'),
/// 'latesttag:<url>:<selector>' (custom repo). Resolved once at init.
/// Explicit: 'gittag:<tag>', 'gittag:<url>:<tag>', 'gitcommit:<sha>',
/// 'gitcommit:<url>:<sha>', 'gitbranch:<branch>', 'gitbranch:<url>:<branch>',
/// 'local:/path/to/filecoin-services'.
#[arg(long)]
filecoin_services: Option<String>,
/// Yugabyte download URL
#[arg(long)]
yugabyte_url: Option<String>,
/// Path to local Yugabyte archive file (.tar.gz) to use instead of downloading
#[arg(long)]
yugabyte_archive: Option<String>,
/// Path to local filecoin-proof-params directory to use instead of downloading
#[arg(long)]
proof_params_dir: Option<String>,
/// Force regeneration of config file even if it exists
#[arg(long)]
force: bool,
/// Use random mnemonic instead of deterministic one
#[arg(long)]
rand: bool,
/// Skip building Docker images (useful when images are already cached)
#[arg(long)]
no_docker_build: bool,
},
/// Build Filecoin projects in a container
Build {
#[command(subcommand)]
build_command: BuildCommands,
},
/// Show status of the foc-devnet system
Status,
/// Show version information
Version,
}
/// Build subcommands
#[derive(Subcommand)]
pub enum BuildCommands {
/// Build Lotus (lotus and lotus-miner)
Lotus {
/// Path to the Lotus source directory (optional, will clone if not provided)
path: Option<PathBuf>,
},
/// Build Curio
Curio {
/// Path to the Curio source directory (optional, will clone if not provided)
path: Option<PathBuf>,
},
}
/// Config subcommands
#[derive(Subcommand)]
pub enum ConfigCommands {
/// Configure Lotus source location
Lotus {
/// Lotus source location (e.g., 'latesttag', 'latesttag:v*', 'latesttag:<url>:v*', 'gittag:v1.0.0', 'gitcommit:abc123', 'gitbranch:main', 'local:/path/to/lotus')
source: String,
},
/// Configure Curio source location
Curio {
/// Curio source location (e.g., 'latesttag', 'latesttag:pdp/v*', 'latesttag:<url>:pdp/v*', 'gittag:v1.0.0', 'gitcommit:abc123', 'gitbranch:main', 'local:/path/to/curio')
source: String,
},
}