Skip to content

Commit 54a4b34

Browse files
committed
Merge branch 'issue-6-list-scaffold-r060-stack' into release/0.6.0
2 parents f70eb5a + 6986547 commit 54a4b34

4 files changed

Lines changed: 33 additions & 10 deletions

File tree

crates/solverforge-cli/WIREFRAME.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ Scaffolds a complete SolverForge project from embedded templates.
8787
|------|----------|----------------|
8888
| `--basic` | Generic skeleton | Standard (basic) variable |
8989
| `--basic=employee-scheduling` | Pre-built employee shift scheduling | Standard (basic) variable |
90-
| `--list` | Generic list-variable skeleton | List variable |
9190
| `--list=vehicle-routing` | Pre-built CVRP domain | List variable |
9291

9392
**Optional flags:**

crates/solverforge-cli/src/commands/new.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const AVAILABLE_TEMPLATES: &str = "
2020
--basic=employee-scheduling — assign employees to shifts
2121
2222
List Variable (each entity owns an ordered sequence):
23-
--list — generic list-variable skeleton (coming soon)
2423
--list=vehicle-routing — capacitated vehicle routing (CVRP)";
2524

2625
pub fn run(
@@ -54,10 +53,6 @@ pub fn run(
5453
skip_readme,
5554
quiet,
5655
),
57-
Template::List => Err(CliError::with_hint(
58-
"the generic list-variable skeleton is not yet available",
59-
format!("Available templates:{AVAILABLE_TEMPLATES}"),
60-
)),
6156
Template::ListVehicleRouting => scaffold(
6257
name,
6358
&crate_name,
@@ -350,7 +345,6 @@ fn generate_readme(project_name: &str, _crate_name: &str, label: &str) -> String
350345
pub enum Template {
351346
Basic,
352347
BasicEmployeeScheduling,
353-
List,
354348
ListVehicleRouting,
355349
}
356350

@@ -359,7 +353,10 @@ impl Template {
359353
match (basic, list, specialization) {
360354
(true, false, None) => Ok(Template::Basic),
361355
(true, false, Some("employee-scheduling")) => Ok(Template::BasicEmployeeScheduling),
362-
(false, true, None) => Ok(Template::List),
356+
(false, true, None) => Err(CliError::with_hint(
357+
"the --list template requires a specialization",
358+
"Use --list=vehicle-routing".to_string(),
359+
)),
363360
(false, true, Some("vehicle-routing")) => Ok(Template::ListVehicleRouting),
364361
(false, false, None) => Err(CliError::with_hint(
365362
"specify a template flag",

crates/solverforge-cli/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ enum Command {
5454
/// Variable class (required, mutually exclusive):
5555
///
5656
/// --basic Standard variable — each entity holds one assigned value
57-
/// --list List variable — each entity owns an ordered sequence
57+
/// --list=... List variable — each entity owns an ordered sequence
5858
///
5959
/// Specializations (append after the flag with =):
6060
///
@@ -71,7 +71,7 @@ enum Command {
7171
#[arg(long = "basic", value_name = "SPECIALIZATION", num_args = 0..=1, require_equals = true)]
7272
basic: Option<Option<String>>,
7373

74-
/// Scaffold a list-variable project (optionally: --list=vehicle-routing)
74+
/// Scaffold a list-variable project specialization (currently: --list=vehicle-routing)
7575
#[arg(long = "list", value_name = "SPECIALIZATION", num_args = 0..=1, require_equals = true)]
7676
list: Option<Option<String>>,
7777

crates/solverforge-cli/tests/scaffold_test.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,33 @@ fn test_new_vehicle_routing_creates_domain() {
131131
);
132132
}
133133

134+
// Bare --list should be rejected because the generic list scaffold is not supported.
135+
#[test]
136+
fn test_new_list_requires_specialization() {
137+
let tmp = tempfile::tempdir().expect("failed to create temp dir");
138+
139+
let output = Command::new(cli_bin())
140+
.args(["new", "test_list_project", "--list"])
141+
.current_dir(tmp.path())
142+
.output()
143+
.expect("failed to run solverforge new");
144+
145+
assert!(
146+
!output.status.success(),
147+
"solverforge new --list unexpectedly succeeded"
148+
);
149+
150+
let stderr = String::from_utf8_lossy(&output.stderr);
151+
assert!(
152+
stderr.contains("the --list template requires a specialization"),
153+
"unexpected stderr: {stderr}"
154+
);
155+
assert!(
156+
stderr.contains("Use --list=vehicle-routing"),
157+
"unexpected stderr: {stderr}"
158+
);
159+
}
160+
134161
// Full cargo check on a scaffolded basic project.
135162
// Requires network access and a full Rust toolchain.
136163
// Run with: cargo test -p solverforge-cli -- --ignored

0 commit comments

Comments
 (0)