Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add all field as example value when initing #209

Merged
merged 4 commits into from
Feb 13, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions crates/cli/src/commands/components/init.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use url::Url;

use crate::components::{
boilerplate::{CATEGORY_OPTIONS, LANGUAGE_OPTIONS, SUBCATEGORY_OPTIONS},
manifest::{self, Build, Manifest, Package},
manifest::{self, Build, ConfigField, Manifest, Package},
};

#[derive(Debug, clap::Parser)]
Expand Down Expand Up @@ -54,10 +56,22 @@ pub async fn run(_opts: Options) -> anyhow::Result<()> {
wit_world_version: "0.4.0".to_string(),
category: *component_category.value,
subcategory: *component_subcategory.value,
description: None,
documentation: None,
repository: None,
config_fields: Default::default(),
description: Some("Description of the component".to_string()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be great to provide a multi-line string by default :) like this:

description = '''
Here is a 
string
'''

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image Updated !

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to force [component.build] to appear before the settings? or is that done automatically during serialization?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea : Done
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the order in the object class definition

documentation: Some(Url::parse("https://www.edgee.cloud/docs/introduction")?),
repository: Some(Url::parse("https://www.github.com/edgee-cloud/edgee")?),
config_fields: {
let mut fields = std::collections::HashMap::new();
fields.insert(
"example".to_string(),
ConfigField {
description: Some("Example config field".to_string()),
required: true,
title: "ExampleConfigField".to_string(),
type_: edgee_api_client::types::ConfigurationFieldType::String,
},
);
fields
},
build: Build {
command: component_language.default_build_command.to_string(),
output_path: std::path::PathBuf::from(""),
Expand Down