feat(commands): prompt the path/file commands for their path (bucket D)

SCRIPT/SCR, DATALINK, LANDXMLIMPORT, CUIEXPORT, CUIIMPORT/CUILOAD now prompt
for the path via ValuePromptCommand instead of printing usage when run bare;
each dispatches `NAME <path>` to the existing inline handler. The path keeps
its case (dispatch does not upper-case arguments), so case-sensitive paths on
Linux/macOS still resolve. A native file dialog would be a nicer follow-up.
This commit is contained in:
Hakan Seven committed 2026-07-16 14:40:11 +03:00
1 parent 208e617868
commit f0f9a57bf6
3 files changed
+36 -13

No files matched your search

+7 -5
View File
@@ -330,11 +330,13 @@ impl OpenCADStudio {
// SCRIPT <path> — run a command script: each non-blank, non-comment
// line is fed through the same command path the `--script` startup
// flag uses, so the behaviour matches headless automation exactly.
cmd if cmd == "SCRIPT"
|| cmd == "SCR"
|| cmd.starts_with("SCRIPT ")
|| cmd.starts_with("SCR ") =>
{
"SCRIPT" | "SCR" => {
use crate::command::ValuePromptCommand;
let c = ValuePromptCommand::new("SCRIPT", "SCRIPT path to the .scr file:");
self.command_line.push_info(&c.prompt());
self.tabs[i].active_cmd = Some(Box::new(c));
}
cmd if cmd.starts_with("SCRIPT ") || cmd.starts_with("SCR ") => {
let path = cmd.split_once(' ').map(|(_, r)| r.trim().to_string());
match path {
Some(p) if !p.is_empty() => match std::fs::read_to_string(&p) {