mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
refactor(cli): drop duplicate --in-place help and a panicking matches lookup (#7071)
batch --help printed the "--out that is the --in folder is refused" sentence twice, in the subcommand's long help and on --in-place. Keep it on the flag, where -h shows it too. steps() read --cmd/--params with get_many, which panics on a type mismatch, against the crate's never-panic rule. Use try_get_many and treat an error as no values; behaviour is otherwise the same. Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 file changed
+1
-4
@@ -130,9 +130,6 @@ pub(crate) struct RunArgs {
|
||||
/// droplet). An Actions set (the Actions panel's actions.json, {"actions": [{"name", "steps"}…]})
|
||||
/// plays the action --action names (needed when the set holds more than one) with the whole set
|
||||
/// loaded, so its steps can play other actions of the set.
|
||||
///
|
||||
/// An --out folder that is the --in folder is refused, as the results would replace the
|
||||
/// originals; --in-place allows it.
|
||||
#[derive(Args)]
|
||||
pub(crate) struct BatchArgs {
|
||||
/// The action list: actions.json, a droplet, or a Photoshop Actions file (.atn)
|
||||
@@ -228,7 +225,7 @@ pub(crate) struct ServeArgs {
|
||||
fn steps(m: &ArgMatches) -> Vec<(bool, String)> {
|
||||
let mut steps: Vec<(usize, bool, String)> = Vec::new();
|
||||
for (id, is_cmd) in [("cmd", true), ("params", false)] {
|
||||
if let (Some(at), Some(values)) = (m.indices_of(id), m.get_many::<String>(id)) {
|
||||
if let (Some(at), Some(values)) = (m.indices_of(id), m.try_get_many::<String>(id).ok().flatten()) {
|
||||
steps.extend(at.zip(values).map(|(i, v)| (i, is_cmd, v.clone())));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user