Could snapcraft replace the command in usage output with the actual command?

I just packaged the device-tree-compiler for linux to quickly hack on some devicetee changes for an Ubuntu Core image …

This was a breeze to do (took less than 5 min in total to get a snap tree and build.snapcraft.io up and running)

One thing that struck me though is that the help output of the command does not actually give me the command name the enduser uses, but the actual binary name that is used as the “app:” endpoint…
i.e:

ogra@nanopi:~$ devicetree-compiler --help|grep Usage
Usage: dtc [options] <input file>
ogra@nanopi:~$ 

Could snapcraft not magically replace the command name with the command the user actually ran ?

That output is hard-coded in the source of dtc. It’s not going to change regardless of what the binary is called in a Snapcraft context.

well, a parser/wrapper could replace the output :wink:

Actually it’s similarly bad when using argv[0]:

 project.command -h
Usage: /snap/project/17/bin/command [options]

well, indeed you would want … “$(basename $0)” …
(and also from /snap/bin, not from the target command)