Issue adding second app to Snap package

I’m trying to add a command line interface to my snap package. The CLI is an executable at $SNAP/bin/argos-translate-cli that works when installing with pip. I also have a second executable for the GUI $SNAP/bin/argos-translate which works. I removed some of the plugs that the GUI application used but that doesn’t seem to be the problem. I can build and install my Snap package with both executables fine but the CLI can’t be found.

apps:
  argos-translate:
    adapter: full
    command: desktop-launch $SNAP/bin/argos-translate
    environment:
      DISABLE_WAYLAND: 1
    plugs:
      - desktop
      - desktop-legacy
      - opengl
      - wayland
      - x11
  argos-translate-cli:
    command: bin/argos-translate-cli
$ argos-translate-cli
argos-translate-cli: command not found

Full code

snap apps are usually using a naming scheme of <snapname>.<appname> so theoretically you would have to call /snap/bin/argos-translate.argos-translate but since this is inconvenient for apps that have the same name as their snap package this rule does not apply for any app that matches the name of the snap …

any other app you add to such a snap will have to follow that schema though … so you have to call your cli app as:
argos-translate.argos-translate-cli

since this is awkward, i typically try to shorten the new name if i add additional apps to such snaps … i.e. just call your app “cli” in snapcraft yaml and you end up with:

argos-translate.cli

you can also see the cmmands your snap ships with the snap info --verbose ... command

Thanks for the response, that makes sense. Changing the app to argos-translate.argos-translate-cli seems to cause different issues.

apps:
  argos-translate:
    adapter: full
    command: desktop-launch $SNAP/bin/argos-translate
    environment:
      DISABLE_WAYLAND: 1
    plugs:
      - desktop
      - desktop-legacy
      - opengl
      - wayland
      - x11
  argos-translate.argos-translate-cli:
    command: $SNAP/bin/argos-translate-cli
$ SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=4G snapcraft
Issues while validating snapcraft.yaml: The 'apps' property does not match the required schema: 'argos-translate' is not a valid app name. App names consist of upper- and lower-case alphanumeric characters and hyphens. They cannot start or end with a hyphen.

ERR, no … that wasnt what i meant … the namespacing happens at install time, you should not do it in your snapcraft.yaml, the excerpt you pasted in your first post did produce /snap/bin/argos-translate.argos-translate-cli … what you are doing now is broken indeed …

what i meant was:

apps:
  argos-translate:
    adapter: full
    command: desktop-launch $SNAP/bin/argos-translate
    environment:
      DISABLE_WAYLAND: 1
    plugs:
      - desktop
      - desktop-legacy
      - opengl
      - wayland
      - x11
  cli:
    command: $SNAP/bin/argos-translate-cli

now at install time snapd will create /snap/bin/argos-translate.cli

1 Like

Oh woops thanks, that worked.