mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-26 03:17:02 +00:00
packaging(linux): support co-installable nightly packages (#4154)
Linux nightly packaging by @dylanmtaylor, with the per-app Nightly flavor commits stacked on his branch. Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
This commit is contained in:
@@ -317,6 +317,16 @@ fn main() {
|
||||
Ok(raw) => raw,
|
||||
Err(e) => fail_usage(&e),
|
||||
};
|
||||
// The Launcher's Nightly profile flags belong to the desktop app only. Refuse them before any
|
||||
// argument is parsed, so no script can drive a profile outside the Launcher's control (exit 2).
|
||||
// Written without a leading `--` in the literal so the option table stays the one place that
|
||||
// declares options (`every_option_read_is_declared`).
|
||||
const DESKTOP_PROFILE_FLAGS: [&str; 2] = ["launch-profile", "profile-root"];
|
||||
if let Some(flag) =
|
||||
raw.iter().find(|a| a.starts_with('-') && DESKTOP_PROFILE_FLAGS.iter().any(|name| a.trim_start_matches('-').split('=').next() == Some(*name)))
|
||||
{
|
||||
fail_usage(&format!("`{flag}` selects the desktop Nightly profile; effectcraft-cli has no launch profile"));
|
||||
}
|
||||
if matches!(raw.first().map(String::as_str), Some("--version" | "-V" | "version")) {
|
||||
say!("effectcraft-cli {}", env!("CARGO_PKG_VERSION"));
|
||||
return;
|
||||
|
||||
@@ -475,6 +475,24 @@ fn unknown_options_are_usage_errors() {
|
||||
}
|
||||
}
|
||||
|
||||
/// The desktop Nightly profile flags belong to the Launcher and the GUI: the headless CLI refuses
|
||||
/// both spellings (and their `=` forms) as a usage error before anything runs.
|
||||
#[test]
|
||||
fn the_desktop_nightly_profile_flags_are_refused() {
|
||||
for args in [
|
||||
&["info", "--launch-profile", "nightly-v1", "--profile-root", "/somewhere", "--json"][..],
|
||||
&["info", "--launch-profile=nightly-v1", "--json"],
|
||||
&["render-frame", "--profile-root=/somewhere", "--out", "x.png"],
|
||||
&["--launch-profile", "nightly-v1", "--version"],
|
||||
] {
|
||||
let out = bin().args(args).output().unwrap();
|
||||
let err = String::from_utf8_lossy(&out.stderr);
|
||||
assert_eq!(out.status.code(), Some(2), "{args:?}: {err}");
|
||||
assert!(err.contains("has no launch profile"), "{args:?}: {err}");
|
||||
assert!(out.stdout.is_empty(), "{args:?}: nothing ran");
|
||||
}
|
||||
}
|
||||
|
||||
/// An argument that is not Unicode (a Latin-1 file name on Linux) is a usage error (exit 2)
|
||||
/// naming it, before anything runs: `std::env::args` panicked on one (exit 101).
|
||||
#[cfg(unix)]
|
||||
|
||||
Reference in New Issue
Block a user