Skip to content

Commit 6c5e715

Browse files
committed
Add clap comments, add additional derives to bindings
Signed-off-by: Mikkel Mork Hegnhoj <[email protected]>
1 parent 9332786 commit 6c5e715

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ anyhow = "1.0.87"
88
clap = { version = "4.5.17", features = ["derive"] }
99
dialoguer = "0.11.0"
1010
reqwest = "0.12.7"
11+
serde = { version = "1.0", features = ["derive"] }
12+
serde_json = "1"
1113
sha2 = "0.10.8"
1214
spin-manifest = { git = "https://github.com/fermyon/spin" }
1315
spin-serde = { git = "https://github.com/fermyon/spin" }

src/commands/bindings.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ pub enum BindingsLanguage {
1414

1515
#[derive(Args, Debug)]
1616
pub struct GenerateBindingsCommand {
17+
/// The programming language to generate bindings in
1718
#[clap(short = 'L', long)]
1819
pub language: BindingsLanguage,
20+
21+
/// Output directory
1922
#[clap(short = 'o', long)]
2023
pub output: PathBuf,
24+
25+
/// Id of the component, which dependencies to generate the bindings for
2126
#[clap(short = 'c', long)]
2227
pub component_id: String,
2328
}
@@ -40,8 +45,18 @@ impl GenerateBindingsCommand {
4045

4146
match &self.language {
4247
BindingsLanguage::Rust => {
48+
// TODO: If wit-bindgen is not in Cargo.toml, make sure to add it.
4349
let opts = wit_bindgen_rust::Opts {
4450
generate_all: true,
51+
// TODO: Make the extra attributes a clap option
52+
additional_derive_attributes: vec![
53+
"serde::Serialize".to_string(),
54+
"serde::Deserialize".to_string(),
55+
"Hash".to_string(),
56+
"Clone".to_string(),
57+
"PartialEq".to_string(),
58+
"Eq".to_string(),
59+
],
4560
// Uncomment this once spin-sdk is updated and remove dependency on wit_bindgen in Cargo.toml
4661
//runtime_path: Some("::spin_sdk::wit_bindgen".to_string()),
4762
..Default::default()

0 commit comments

Comments
 (0)