Passing args to an app's command

How do I pass args to my app’s command in snapcraft.yaml? eg

apps:
  my-app:
    command: bin/my-app [args]

Such that I can run the snap with:
$ my-snap.my-app --arg1 --arg2

Is what you’re asking is to have the options always be specified to the command?

If so then all you need to do is:

apps:
  my-app:
    command: bin/my-app --arg1 --arg2

I want the args to be passed in when running the command. i.e. once my snap has been installed I want to be able to pass optional args to a command:

$ my-snap.my-app --arg1 --arg2

I had assumed there was some equivalent to ‘$1 $2’ but it seems this just works ‘out of the box’!

1 Like

You shouldn’t need to do anything for this… parameters passed on the CLI will make it through to whatever is defined in command.