Invalid options with new CLI

Since the new CLI was merged, I noticed in some cases options are not available as I would expect, and I need to choose now between debug and choosing the target architecture:

$ snapcraft snap --target-arch=arm64 --debug
Error: no such option: --debug

$ snapcraft --target-arch=arm64
Error: no such option: --target-arch

This is

snapcraft --debug snap --target-arch=arm64

I can bring back the devel options to the main command parser, but then these options would be there for all commands, not just the ones related to building.

So I see two problems with that

  • it’s unusually awkward, normally order isn’t significant
  • it’s not discoverable - the error claims the option is unknown

Here is a PR that solves that problem