Files
pdfcraft/apps/pdfcraft-cli
Hamza 755266cf9f cli: the argument bugs photocraft#7071 lists are live here too
Three of them, measured on main:

    pdfcraft-cli extract f.pdf --pages 1 --out --password
    (exit 0, and the PDF is in a file called `--password`)

    pdfcraft-cli check-one --edit f.pdf
    pdfcraft-cli: check-one: missing file

    pdfcraft-cli info /tmp/café.pdf          (that é as one Latin-1 byte)
    thread 'main' panicked at library/std/src/env.rs:878:51:
    called `Result::unwrap()` on an `Err` value

- An option whose value is a **file or folder** refuses a value that is another
  option, and names the way out for a file that really starts with `-`:
  `./--name`, as `--root` already offered. That also closes the gap the option
  walk left for those: an unknown option in a value position was skipped along
  with the option it followed, so `combine --out --nonsense` wrote `--nonsense`
  instead of saying what `--nonsense` was.

  Only those options. A password or a title can be any string, `--page`
  included — `an_option_shaped_password_is_not_parsed_as_a_page_flag` pins
  that, and a bad `--page` or `--dpi` is reported by the command in its own
  terms either way.

- `positional` asks the option table which tokens are values, instead of
  skipping the one after every option. The token after a flag that takes none
  is an argument: `check-one --edit f.pdf` read the file as `--edit`'s operand
  and then reported it missing.

- Arguments come through `args_os`, so one that is not UTF-8 is a usage error
  rather than a panic. `std::env::args` panics while collecting them, so even
  `--help` ended that way.

tests/options.rs covers each, and each fails without its fix (the file called
`--password` comes back; "check-one: missing file"; exit 101 with that report).
2026-10-21 18:45:04 +05:00
..