我无法在 snap 中公开脚本

我无法在 snap 中公开脚本

因此,我正在尝试学习如何创建一个 snap 包,并使用一个简单的 python 脚本作为基础(https://gitlab.xirion.net/vroest/dice-roller/tree/master)。
我已经让 snapcraft 正常工作,并安装了 snap 包,但我无法从我的终端运行脚本。

snap install --devmode --dangerous cli-diceroller_1.9_amd64.snap

我已遵循此处的指南:https://tutorials.ubuntu.com/tutorial/create-your-first-snap#3
这是 yaml 文件:

name: cli-diceroller
base: core18
version: '1.9'
summary: A python dice rolling application using standard dice notation
description: |
  Syntax is: roll <dice_code>
  Example: roll 2d8 + 6 + d8
  Instead of a dice code you can also put "stats" or "dir" for a stats roll or direction roll respectively.

grade: devel
confinement: devmode

apps:
  roll:
    command: bin/roll

parts:
  diceroller:
    plugin: python
    python-version: python3
    source: https://gitlab.xirion.net/vroest/dice-roller.git

当我运行此命令时,脚本正常运行

/snap/cli-diceroller/x1/bin/roll

我错过了什么?

答案1

当应用程序名称(roll在本例中)与 snap 名称()不同时,cli-diceroller将安装二进制文件以<snap-name>.<app-name>防止命名空间冲突:

$ cli-diceroller.roll
Syntax is: roll <dice_code>
Example: roll 2d8 + 6 + d8
Instead of a dice code you can also put "stats" or "dir" for a stats roll or direction roll respectively

如果您将部件重命名为cli-diceroller,则可执行文件将以该名称提供。(这在snapcraft.yaml 参考

相关内容