From a7c7595508b1806b64d42a1f1cf2622bb4cdfbf0 Mon Sep 17 00:00:00 2001 From: ReeseHatfield Date: Wed, 2 Sep 2026 07:54:00 -0400 Subject: [PATCH 1/8] description cli arg --- scripts/test-init.sh | 2 +- src/cmd/init.rs | 3 +++ src/config.rs | 13 +++++++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/test-init.sh b/scripts/test-init.sh index 7f8e5b9..84c0038 100755 --- a/scripts/test-init.sh +++ b/scripts/test-init.sh @@ -12,6 +12,6 @@ cd test pwd -./oseda init --title ExampleProject --tags economics ComPuterScience --color red --template HTML +./oseda init --title ExampleProject --tags economics ComPuterScience --color red --template HTML --description "This is an example project" mv oseda ExampleProject \ No newline at end of file diff --git a/src/cmd/init.rs b/src/cmd/init.rs index 35e092c..64c30b4 100644 --- a/src/cmd/init.rs +++ b/src/cmd/init.rs @@ -24,6 +24,9 @@ pub struct InitOptions { #[arg(long)] pub template: Option, + + #[arg(long)] + pub description: Option } // embed all the static markdown template files into binary diff --git a/src/config.rs b/src/config.rs index a528d62..8041fb9 100644 --- a/src/config.rs +++ b/src/config.rs @@ -125,6 +125,9 @@ pub struct OsedaConfig { pub license: License, } + +const DEFAULT_DESCIPTION: &'static str = "Fill in project description"; + pub fn prompt_for_title() -> Result> { let validator = |input: &str| { if input.chars().count() < 2 { @@ -171,6 +174,13 @@ pub fn create_conf(options: InitOptions) -> Result> let user_name = github::get_config_from_user_git("user.name") .ok_or("Could not get github username. Please ensure you are signed into github")?; + let description = match options.description { + Some(desc) => desc, + None => { + DEFAULT_DESCIPTION.to_owned() + }, + }; + let license = prompt_for_license()?; Ok(OsedaConfig { @@ -183,8 +193,7 @@ pub fn create_conf(options: InitOptions) -> Result> last_updated: get_time(), color: color.into_hex(), license, - // start them with empty description - description: String::new(), + description }) } From 42d95f6b0574e635139b76a1dd822b7f4d0ca4bc Mon Sep 17 00:00:00 2001 From: ReeseHatfield Date: Wed, 2 Sep 2026 08:05:57 -0400 Subject: [PATCH 2/8] license as CLI arg --- scripts/test-init.sh | 2 +- src/cmd/init.rs | 3 +++ src/config.rs | 12 +++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/test-init.sh b/scripts/test-init.sh index 84c0038..8bbf413 100755 --- a/scripts/test-init.sh +++ b/scripts/test-init.sh @@ -12,6 +12,6 @@ cd test pwd -./oseda init --title ExampleProject --tags economics ComPuterScience --color red --template HTML --description "This is an example project" +./oseda init --title ExampleProject --tags economics ComPuterScience --color red --template HTML --description "This is an example project" --license mit mv oseda ExampleProject \ No newline at end of file diff --git a/src/cmd/init.rs b/src/cmd/init.rs index 64c30b4..41d72a0 100644 --- a/src/cmd/init.rs +++ b/src/cmd/init.rs @@ -25,6 +25,9 @@ pub struct InitOptions { #[arg(long)] pub template: Option, + #[arg(long)] + pub license: Option, + #[arg(long)] pub description: Option } diff --git a/src/config.rs b/src/config.rs index 8041fb9..f8b7128 100644 --- a/src/config.rs +++ b/src/config.rs @@ -181,7 +181,17 @@ pub fn create_conf(options: InitOptions) -> Result> }, }; - let license = prompt_for_license()?; + + let license = match options.license { + Some(proposed_license) => { + License::try_from(proposed_license.clone()).or_else(|_| { + eprintln!("Error: Invalid license '{}', please select from the following:", proposed_license); + prompt_for_license() + })? + } + None => prompt_for_license()?, + }; + Ok(OsedaConfig { title: title.trim().to_owned(), From 1a089a0b755530c26950f4321cf40fa49b99d160 Mon Sep 17 00:00:00 2001 From: ReeseHatfield Date: Wed, 2 Sep 2026 08:26:20 -0400 Subject: [PATCH 3/8] rework tag parsing to use commas over spaces --- scripts/test-init.sh | 8 +++++++- src/cmd/init.rs | 4 ++-- src/config.rs | 6 +++--- src/license.rs | 24 ++++++++++++------------ 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/scripts/test-init.sh b/scripts/test-init.sh index 8bbf413..fb5dd8b 100755 --- a/scripts/test-init.sh +++ b/scripts/test-init.sh @@ -12,6 +12,12 @@ cd test pwd -./oseda init --title ExampleProject --tags economics ComPuterScience --color red --template HTML --description "This is an example project" --license mit +./oseda init \ + --title ExampleProject \ + --tags "economics, ComPuterScience" \ + --color red \ + --template HTML \ + --description "This is an example project" \ + --license "gPl-2.0" mv oseda ExampleProject \ No newline at end of file diff --git a/src/cmd/init.rs b/src/cmd/init.rs index 41d72a0..b654fd7 100644 --- a/src/cmd/init.rs +++ b/src/cmd/init.rs @@ -16,7 +16,7 @@ pub struct InitOptions { #[arg(long)] pub title: Option, - #[arg(long, num_args = 1.., value_delimiter=' ')] + #[arg(long, value_delimiter=',')] pub tags: Option>, #[arg(long)] @@ -27,7 +27,7 @@ pub struct InitOptions { #[arg(long)] pub license: Option, - + #[arg(long)] pub description: Option } diff --git a/src/config.rs b/src/config.rs index f8b7128..8701fab 100644 --- a/src/config.rs +++ b/src/config.rs @@ -158,13 +158,13 @@ pub fn create_conf(options: InitOptions) -> Result> Some(arg_tags) => { arg_tags .iter() - .map(|arg_tag| DefinedTag::from_str(arg_tag)) + .map(|arg_tag| DefinedTag::from_str(arg_tag.trim())) .collect::, _>>() .map_err(|_| "Invalid tag. Custom Tags may be added to the oseda-config.json after initialization".to_string())? }, None => prompt_for_tags()? }; - + let color = match options.color { Some(arg_color) => Color::from_str(&arg_color) .map_err(|_| "Invalid color. Please use traditional english color names".to_string())?, @@ -172,7 +172,7 @@ pub fn create_conf(options: InitOptions) -> Result> }; let user_name = github::get_config_from_user_git("user.name") - .ok_or("Could not get github username. Please ensure you are signed into github")?; + .ok_or("Could not get GitHub username. Please ensure you are signed into github")?; let description = match options.description { Some(desc) => desc, diff --git a/src/license.rs b/src/license.rs index 32220e0..0453cf2 100644 --- a/src/license.rs +++ b/src/license.rs @@ -10,29 +10,29 @@ pub enum License { // strum serialize is compatible with serde trait here // this will basically allow a complex internal license representation // but with ease of de/serialization with just the spdx id - #[strum(serialize = "Apache-2.0")] + #[strum(serialize = "Apache-2.0", ascii_case_insensitive)] Apache2_0, - #[strum(serialize = "MIT")] + #[strum(serialize = "MIT", ascii_case_insensitive)] Mit, - #[strum(serialize = "CDDL-1.0")] + #[strum(serialize = "CDDL-1.0", ascii_case_insensitive)] Cddl1_0, - #[strum(serialize = "EPL-2.0")] + #[strum(serialize = "EPL-2.0", ascii_case_insensitive)] Epl2_0, - #[strum(serialize = "GPL-2.0")] + #[strum(serialize = "GPL-2.0", ascii_case_insensitive)] Gpl2_0, - #[strum(serialize = "GPL-3.0")] + #[strum(serialize = "GPL-3.0", ascii_case_insensitive)] Gpl3_0, - #[strum(serialize = "LGPL-2.1")] + #[strum(serialize = "LGPL-2.1", ascii_case_insensitive)] Lgpl2_1, - #[strum(serialize = "LGPL-3.0")] + #[strum(serialize = "LGPL-3.0", ascii_case_insensitive)] Lgpl3_0, - #[strum(serialize = "LGPL-2.0")] + #[strum(serialize = "LGPL-2.0", ascii_case_insensitive)] Lgpl2_0, - #[strum(serialize = "MPL-2.0")] + #[strum(serialize = "MPL-2.0", ascii_case_insensitive)] Mpl2_0, - #[strum(serialize = "BSD-2-Clause")] + #[strum(serialize = "BSD-2-Clause", ascii_case_insensitive)] Bsd2Clause, - #[strum(serialize = "BSD-3-Clause")] + #[strum(serialize = "BSD-3-Clause", ascii_case_insensitive)] Bsd3Clause, } From 2dbcd60f46414a292c34e1dee9a81c8471055b05 Mon Sep 17 00:00:00 2001 From: ReeseHatfield Date: Wed, 2 Sep 2026 08:32:53 -0400 Subject: [PATCH 4/8] case insensitive bad desciption check --- src/config.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index 8701fab..c447b73 100644 --- a/src/config.rs +++ b/src/config.rs @@ -96,7 +96,7 @@ pub fn validate_config( )); } - if conf.description.is_empty() { + if conf.description.is_empty() || conf.description.eq_ignore_ascii_case(DEFAULT_DESCIPTION) { return Err(OsedaCheckError::MissingDescription( "Description is missing or empty. Please update the oseda-config.json".to_owned(), )); @@ -164,7 +164,7 @@ pub fn create_conf(options: InitOptions) -> Result> }, None => prompt_for_tags()? }; - + let color = match options.color { Some(arg_color) => Color::from_str(&arg_color) .map_err(|_| "Invalid color. Please use traditional english color names".to_string())?, From 247fd5edb565a2870c34acc3248cd624f82c4049 Mon Sep 17 00:00:00 2001 From: ReeseHatfield Date: Wed, 2 Sep 2026 09:01:08 -0400 Subject: [PATCH 5/8] provide descriptions to init help menu from clap --- src/cmd/init.rs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/cmd/init.rs b/src/cmd/init.rs index b654fd7..ca03163 100644 --- a/src/cmd/init.rs +++ b/src/cmd/init.rs @@ -13,23 +13,32 @@ use crate::{config, template::Template}; /// Options for the `oseda init` command #[derive(Args, Debug)] pub struct InitOptions { - #[arg(long)] + // claps 'value_name' does not change the argument name, basically just the value in the help menu, + // e.g --template + + /// Project Title + #[arg(long, value_name = "TITLE")] pub title: Option, - #[arg(long, value_delimiter=',')] + /// Project Tags [e.g: ComputerScience,Engineering,...] + #[arg(long, value_delimiter = ',', value_name = "TAG1,TAG2,...")] pub tags: Option>, - #[arg(long)] + /// Project Color [e.g: Red] + #[arg(long, value_name = "COLOR")] pub color: Option, - #[arg(long)] + /// Project Template Format [HTML | Markdown] + #[arg(long, value_name = "FORMAT")] pub template: Option, - #[arg(long)] + /// OSI License SPDX identifier [e.g: MIT] + #[arg(long, value_name = "SPDX_ID")] pub license: Option, - #[arg(long)] - pub description: Option + /// Project Description + #[arg(long, value_name = "TEXT")] + pub description: Option, } // embed all the static markdown template files into binary From 310086c7bf611f8f24a2c5c2c0c8cb4b510b0620 Mon Sep 17 00:00:00 2001 From: ReeseHatfield Date: Wed, 2 Sep 2026 10:29:26 -0400 Subject: [PATCH 6/8] update usage.md --- Usage.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Usage.md b/Usage.md index 0ed32e1..c9953e7 100644 --- a/Usage.md +++ b/Usage.md @@ -39,10 +39,12 @@ Initialize a new Oseda project in the working directory ###### **Options:** -* `--title ` -* `--tags <TAGS>` -* `--color <COLOR>` -* `--template <TEMPLATE>` +* `--title <TITLE>` — Project Title +* `--tags <TAG1,TAG2,...>` — Project Tags [e.g: ComputerScience,Engineering,...] +* `--color <COLOR>` — Project Color [e.g: Red] +* `--template <FORMAT>` — Project Template Format [HTML | Markdown] +* `--license <SPDX_ID>` — OSI License SPDX identifier [e.g: MIT] +* `--description <TEXT>` — Project Description From af358e717dcbeb03a39875c69f36b8a7f324b8fd Mon Sep 17 00:00:00 2001 From: ReeseHatfield <reesehatfield02@gmail.com> Date: Wed, 2 Sep 2026 10:30:53 -0400 Subject: [PATCH 7/8] create update usage script --- scripts/update-usage.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 scripts/update-usage.sh diff --git a/scripts/update-usage.sh b/scripts/update-usage.sh new file mode 100755 index 0000000..8fb1d0a --- /dev/null +++ b/scripts/update-usage.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# updates the usage.md file based on clap doc comments + +cargo run --bin oseda-usage \ No newline at end of file From 992df8c4abfb3285743f17656650a9547ba8fa28 Mon Sep 17 00:00:00 2001 From: ReeseHatfield <reesehatfield02@gmail.com> Date: Wed, 2 Sep 2026 10:31:32 -0400 Subject: [PATCH 8/8] semver: breaking change, bump to 3.0.0 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fa23687..541f513 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1059,7 +1059,7 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "oseda-cli" -version = "2.7.0" +version = "3.0.0" dependencies = [ "chrono", "clap", diff --git a/Cargo.toml b/Cargo.toml index dd042b3..79233ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ homepage = "https://oseda.net" repository = "https://github.com/oseda-dev/oseda-cli" readme = "README.md" name = "oseda-cli" -version = "2.7.0" +version = "3.0.0" edition = "2021" [[bin]]