Skip to content

Commit 8f18182

Browse files
committed
feat: clean up commands and improve help docs
Resolves #118
1 parent 181d198 commit 8f18182

File tree

1 file changed

+28
-30
lines changed

1 file changed

+28
-30
lines changed

src/frontend/cli.rs

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,43 +37,41 @@ enum Command {
3737
/// Create and scaffold a new project
3838
#[clap(name = "new")]
3939
New(GenerateProject),
40-
/// Contract subcommand
40+
/// Subcommands for working with contracts
4141
#[clap(subcommand, name = "contract")]
4242
Contract(Contract),
43-
/// Load contracts in a REPL for interactions
44-
#[clap(name = "poke")]
45-
Poke(Poke),
46-
#[clap(name = "console")]
47-
Console(Poke),
43+
/// Load contracts in a REPL for an interactive session
44+
#[clap(name = "console", aliases = &["poke"])]
45+
Console(Console),
4846
/// Execute test suite
4947
#[clap(name = "test")]
5048
Test(Test),
51-
/// Check contracts syntax
49+
/// Check syntax of your contracts
5250
#[clap(name = "check")]
5351
Check(Check),
5452
/// Publish contracts on chain
5553
#[clap(name = "publish")]
5654
Publish(Publish),
57-
/// Execute Clarinet Extension
55+
/// Execute Clarinet extension
5856
#[clap(name = "run")]
5957
Run(Run),
60-
/// Work on contracts integration
58+
/// Start devnet environment for integration testing
6159
#[clap(name = "integrate")]
6260
Integrate(Integrate),
63-
/// Start a LSP session
61+
/// Start an LSP server (for integration with editors)
6462
#[clap(name = "lsp")]
6563
LSP,
6664
}
6765

6866
#[derive(Clap, PartialEq, Clone, Debug)]
6967
enum Contract {
70-
/// New contract subcommand
68+
/// Generate files and settings for a new contract
7169
#[clap(name = "new")]
7270
NewContract(NewContract),
73-
/// Import contract subcommand
71+
/// Add third-party requirements to this project
7472
#[clap(name = "requirement")]
75-
LinkContract(LinkContract),
76-
/// Fork contract subcommand
73+
Requirement(Requirement),
74+
/// Replicate a third-party contract into this project
7775
#[clap(name = "fork")]
7876
ForkContract(ForkContract),
7977
}
@@ -82,9 +80,9 @@ enum Contract {
8280
struct GenerateProject {
8381
/// Project's name
8482
pub name: String,
85-
/// Enable developer usage telemetry
86-
#[clap(long = "disable-telemetry")]
87-
pub disable_telemetry: Option<bool>,
83+
/// Do not provide developer usage telemetry for this project
84+
#[clap(long = "disable-telemetry", takes_value = false)]
85+
pub disable_telemetry: bool,
8886
}
8987

9088
#[derive(Clap, PartialEq, Clone, Debug)]
@@ -97,8 +95,8 @@ struct NewContract {
9795
}
9896

9997
#[derive(Clap, PartialEq, Clone, Debug)]
100-
struct LinkContract {
101-
/// Contract id
98+
struct Requirement {
99+
/// Contract id (ex. " SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait")
102100
pub contract_id: String,
103101
/// Path to Clarinet.toml
104102
#[clap(long = "manifest-path")]
@@ -107,7 +105,7 @@ struct LinkContract {
107105

108106
#[derive(Clap, PartialEq, Clone, Debug)]
109107
struct ForkContract {
110-
/// Contract id
108+
/// Contract id (ex. " SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait")
111109
pub contract_id: String,
112110
/// Path to Clarinet.toml
113111
#[clap(long = "manifest-path")]
@@ -118,7 +116,7 @@ struct ForkContract {
118116
}
119117

120118
#[derive(Clap, PartialEq, Clone, Debug)]
121-
struct Poke {
119+
struct Console {
122120
/// Path to Clarinet.toml
123121
#[clap(long = "manifest-path")]
124122
pub manifest_path: Option<String>,
@@ -136,7 +134,7 @@ struct Integrate {
136134

137135
#[derive(Clap, PartialEq, Clone, Debug)]
138136
struct Test {
139-
/// Generate coverage
137+
/// Generate coverage file (coverage.lcov)
140138
#[clap(long = "coverage")]
141139
pub coverage: bool,
142140
/// Generate costs report
@@ -145,10 +143,10 @@ struct Test {
145143
/// Path to Clarinet.toml
146144
#[clap(long = "manifest-path")]
147145
pub manifest_path: Option<String>,
148-
/// Relaunch tests on updates
146+
/// Relaunch tests upon updates to contracts
149147
#[clap(long = "watch")]
150148
pub watch: bool,
151-
/// Files to includes
149+
/// Test files to be included (defaults to all tests found under tests/)
152150
pub files: Vec<String>,
153151
}
154152

@@ -249,8 +247,8 @@ pub fn main() {
249247
};
250248

251249
let telemetry_enabled = if cfg!(feature = "telemetry") {
252-
if let Some(disable_telemetry) = project_opts.disable_telemetry {
253-
!disable_telemetry
250+
if project_opts.disable_telemetry {
251+
false
254252
} else {
255253
println!("{}", yellow!("Send usage data to Hiro."));
256254
println!("{}", yellow!("Help Hiro improve its products and services by automatically sending diagnostics and usage data."));
@@ -309,7 +307,7 @@ pub fn main() {
309307
display_post_check_hint();
310308
}
311309
}
312-
Contract::LinkContract(required_contract) => {
310+
Contract::Requirement(required_contract) => {
313311
let manifest_path = get_manifest_path_or_exit(required_contract.manifest_path);
314312

315313
let change = TOMLEdition {
@@ -380,14 +378,14 @@ pub fn main() {
380378
}
381379
}
382380
},
383-
Command::Poke(cmd) | Command::Console(cmd) => {
381+
Command::Console(cmd) => {
384382
let manifest_path = get_manifest_path_or_exit(cmd.manifest_path);
385383
let start_repl = true;
386384
let (_, _, project_manifest, _) =
387385
load_session(manifest_path, start_repl, &Network::Devnet)
388386
.expect("Unable to start REPL");
389387
if hints_enabled {
390-
display_post_poke_hint();
388+
display_post_console_hint();
391389
}
392390
if project_manifest.project.telemetry {
393391
#[cfg(feature = "telemetry")]
@@ -756,7 +754,7 @@ fn display_post_check_hint() {
756754
display_hint_footer();
757755
}
758756

759-
fn display_post_poke_hint() {
757+
fn display_post_console_hint() {
760758
println!("");
761759
display_hint_header();
762760
println!(

0 commit comments

Comments
 (0)