Skip to content

Commit

Permalink
CLI: lxc storage volume completion fixes and command description up…
Browse files Browse the repository at this point in the history
…date (#14702)

Fixes #14682.

Summary of changes:

- Fixes shell completions for `lxc storage volume show`.
`GetStoragePoolVolumeNames` returns the full volume name including
"/snapshots/", which is incorrect in the context of the CLI. To address
this issue, parsing has been added to serve valid completions for
snapshot volumes.
- Updates the command description for `lxc storage volume snapshot`.
- Fixes `cmpInstanceSetKeys` logic to provide completions for any
instance keys which are currently set, not just prefixed keys.
  • Loading branch information
tomponline authored Dec 20, 2024
2 parents 3238fa5 + dbc4c86 commit 4df9163
Show file tree
Hide file tree
Showing 42 changed files with 177 additions and 181 deletions.
107 changes: 49 additions & 58 deletions lxc/completion.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lxc/storage_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -2268,7 +2268,7 @@ lxc storage volume show default virtual-machine/data/snap0
}

if len(args) == 1 {
return c.global.cmpStoragePoolVolumes(args[0])
return c.global.cmpStoragePoolVolumes(args[0], "custom")
}

return nil, cobra.ShellCompDirectiveNoFileComp
Expand Down Expand Up @@ -2427,10 +2427,10 @@ func (c *cmdStorageVolumeSnapshot) command() *cobra.Command {
cmd.Short = i18n.G("Snapshot storage volumes")
cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G(
`Snapshot storage volumes`))
cmd.Example = cli.FormatSection("", i18n.G(`lxc storage volume snapshot create default v1 snap0
cmd.Example = cli.FormatSection("", i18n.G(`lxc storage volume snapshot default v1 snap0
Create a snapshot of "v1" in pool "default" called "snap0".
lxc storage volume snapshot create default v1 snap0 < config.yaml
lxc storage volume snapshot default v1 snap0 < config.yaml
Create a snapshot of "v1" in pool "default" called "snap0" with the configuration from "config.yaml".`))

cmd.RunE = c.run
Expand Down
6 changes: 3 additions & 3 deletions po/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-18 08:40-0700\n"
"POT-Creation-Date: 2024-12-19 16:04-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
Expand Down Expand Up @@ -7668,10 +7668,10 @@ msgstr ""

#: lxc/storage_volume.go:2430
msgid ""
"lxc storage volume snapshot create default v1 snap0\n"
"lxc storage volume snapshot default v1 snap0\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\".\n"
"\n"
"lxc storage volume snapshot create default v1 snap0 < config.yaml\n"
"lxc storage volume snapshot default v1 snap0 < config.yaml\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\" with "
"the configuration from \"config.yaml\"."
msgstr ""
Expand Down
6 changes: 3 additions & 3 deletions po/ber.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-18 08:40-0700\n"
"POT-Creation-Date: 2024-12-19 16:04-0700\n"
"PO-Revision-Date: 2022-03-10 15:10+0000\n"
"Last-Translator: Anonymous <[email protected]>\n"
"Language-Team: Berber <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -7671,10 +7671,10 @@ msgstr ""

#: lxc/storage_volume.go:2430
msgid ""
"lxc storage volume snapshot create default v1 snap0\n"
"lxc storage volume snapshot default v1 snap0\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\".\n"
"\n"
"lxc storage volume snapshot create default v1 snap0 < config.yaml\n"
"lxc storage volume snapshot default v1 snap0 < config.yaml\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\" with "
"the configuration from \"config.yaml\"."
msgstr ""
Expand Down
6 changes: 3 additions & 3 deletions po/bg.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-18 08:40-0700\n"
"POT-Creation-Date: 2024-12-19 16:04-0700\n"
"PO-Revision-Date: 2022-03-10 15:09+0000\n"
"Last-Translator: Anonymous <[email protected]>\n"
"Language-Team: Bulgarian <https://hosted.weblate.org/projects/linux-"
Expand Down Expand Up @@ -7671,10 +7671,10 @@ msgstr ""

#: lxc/storage_volume.go:2430
msgid ""
"lxc storage volume snapshot create default v1 snap0\n"
"lxc storage volume snapshot default v1 snap0\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\".\n"
"\n"
"lxc storage volume snapshot create default v1 snap0 < config.yaml\n"
"lxc storage volume snapshot default v1 snap0 < config.yaml\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\" with "
"the configuration from \"config.yaml\"."
msgstr ""
Expand Down
6 changes: 3 additions & 3 deletions po/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-18 08:40-0700\n"
"POT-Creation-Date: 2024-12-19 16:04-0700\n"
"PO-Revision-Date: 2022-03-10 15:10+0000\n"
"Last-Translator: Anonymous <[email protected]>\n"
"Language-Team: Catalan <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -7671,10 +7671,10 @@ msgstr ""

#: lxc/storage_volume.go:2430
msgid ""
"lxc storage volume snapshot create default v1 snap0\n"
"lxc storage volume snapshot default v1 snap0\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\".\n"
"\n"
"lxc storage volume snapshot create default v1 snap0 < config.yaml\n"
"lxc storage volume snapshot default v1 snap0 < config.yaml\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\" with "
"the configuration from \"config.yaml\"."
msgstr ""
Expand Down
6 changes: 3 additions & 3 deletions po/cs.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-18 08:40-0700\n"
"POT-Creation-Date: 2024-12-19 16:04-0700\n"
"PO-Revision-Date: 2022-03-10 15:11+0000\n"
"Last-Translator: Anonymous <[email protected]>\n"
"Language-Team: Czech <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -7671,10 +7671,10 @@ msgstr ""

#: lxc/storage_volume.go:2430
msgid ""
"lxc storage volume snapshot create default v1 snap0\n"
"lxc storage volume snapshot default v1 snap0\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\".\n"
"\n"
"lxc storage volume snapshot create default v1 snap0 < config.yaml\n"
"lxc storage volume snapshot default v1 snap0 < config.yaml\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\" with "
"the configuration from \"config.yaml\"."
msgstr ""
Expand Down
6 changes: 3 additions & 3 deletions po/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: LXD\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-18 08:40-0700\n"
"POT-Creation-Date: 2024-12-19 16:04-0700\n"
"PO-Revision-Date: 2022-03-10 15:06+0000\n"
"Last-Translator: Krombel <[email protected]>\n"
"Language-Team: German <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -9002,10 +9002,10 @@ msgstr ""

#: lxc/storage_volume.go:2430
msgid ""
"lxc storage volume snapshot create default v1 snap0\n"
"lxc storage volume snapshot default v1 snap0\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\".\n"
"\n"
"lxc storage volume snapshot create default v1 snap0 < config.yaml\n"
"lxc storage volume snapshot default v1 snap0 < config.yaml\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\" with "
"the configuration from \"config.yaml\"."
msgstr ""
Expand Down
6 changes: 3 additions & 3 deletions po/el.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-18 08:40-0700\n"
"POT-Creation-Date: 2024-12-19 16:04-0700\n"
"PO-Revision-Date: 2022-03-10 15:06+0000\n"
"Last-Translator: Anonymous <[email protected]>\n"
"Language-Team: Greek <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -7785,10 +7785,10 @@ msgstr ""

#: lxc/storage_volume.go:2430
msgid ""
"lxc storage volume snapshot create default v1 snap0\n"
"lxc storage volume snapshot default v1 snap0\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\".\n"
"\n"
"lxc storage volume snapshot create default v1 snap0 < config.yaml\n"
"lxc storage volume snapshot default v1 snap0 < config.yaml\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\" with "
"the configuration from \"config.yaml\"."
msgstr ""
Expand Down
6 changes: 3 additions & 3 deletions po/eo.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-18 08:40-0700\n"
"POT-Creation-Date: 2024-12-19 16:04-0700\n"
"PO-Revision-Date: 2022-03-10 15:11+0000\n"
"Last-Translator: Anonymous <[email protected]>\n"
"Language-Team: Esperanto <https://hosted.weblate.org/projects/linux-"
Expand Down Expand Up @@ -7671,10 +7671,10 @@ msgstr ""

#: lxc/storage_volume.go:2430
msgid ""
"lxc storage volume snapshot create default v1 snap0\n"
"lxc storage volume snapshot default v1 snap0\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\".\n"
"\n"
"lxc storage volume snapshot create default v1 snap0 < config.yaml\n"
"lxc storage volume snapshot default v1 snap0 < config.yaml\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\" with "
"the configuration from \"config.yaml\"."
msgstr ""
Expand Down
6 changes: 3 additions & 3 deletions po/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-18 08:40-0700\n"
"POT-Creation-Date: 2024-12-19 16:04-0700\n"
"PO-Revision-Date: 2023-06-16 20:55+0000\n"
"Last-Translator: Francisco Serrador <[email protected]>\n"
"Language-Team: Spanish <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -8255,10 +8255,10 @@ msgstr ""

#: lxc/storage_volume.go:2430
msgid ""
"lxc storage volume snapshot create default v1 snap0\n"
"lxc storage volume snapshot default v1 snap0\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\".\n"
"\n"
"lxc storage volume snapshot create default v1 snap0 < config.yaml\n"
"lxc storage volume snapshot default v1 snap0 < config.yaml\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\" with "
"the configuration from \"config.yaml\"."
msgstr ""
Expand Down
6 changes: 3 additions & 3 deletions po/fa.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-18 08:40-0700\n"
"POT-Creation-Date: 2024-12-19 16:04-0700\n"
"PO-Revision-Date: 2022-03-10 15:09+0000\n"
"Last-Translator: Anonymous <[email protected]>\n"
"Language-Team: Persian <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -7671,10 +7671,10 @@ msgstr ""

#: lxc/storage_volume.go:2430
msgid ""
"lxc storage volume snapshot create default v1 snap0\n"
"lxc storage volume snapshot default v1 snap0\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\".\n"
"\n"
"lxc storage volume snapshot create default v1 snap0 < config.yaml\n"
"lxc storage volume snapshot default v1 snap0 < config.yaml\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\" with "
"the configuration from \"config.yaml\"."
msgstr ""
Expand Down
6 changes: 3 additions & 3 deletions po/fi.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-18 08:40-0700\n"
"POT-Creation-Date: 2024-12-19 16:04-0700\n"
"PO-Revision-Date: 2022-03-10 15:08+0000\n"
"Last-Translator: Anonymous <[email protected]>\n"
"Language-Team: Finnish <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -7671,10 +7671,10 @@ msgstr ""

#: lxc/storage_volume.go:2430
msgid ""
"lxc storage volume snapshot create default v1 snap0\n"
"lxc storage volume snapshot default v1 snap0\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\".\n"
"\n"
"lxc storage volume snapshot create default v1 snap0 < config.yaml\n"
"lxc storage volume snapshot default v1 snap0 < config.yaml\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\" with "
"the configuration from \"config.yaml\"."
msgstr ""
Expand Down
6 changes: 3 additions & 3 deletions po/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: LXD\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-18 08:40-0700\n"
"POT-Creation-Date: 2024-12-19 16:04-0700\n"
"PO-Revision-Date: 2022-03-10 15:06+0000\n"
"Last-Translator: Wivik <[email protected]>\n"
"Language-Team: French <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -9283,10 +9283,10 @@ msgstr ""

#: lxc/storage_volume.go:2430
msgid ""
"lxc storage volume snapshot create default v1 snap0\n"
"lxc storage volume snapshot default v1 snap0\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\".\n"
"\n"
"lxc storage volume snapshot create default v1 snap0 < config.yaml\n"
"lxc storage volume snapshot default v1 snap0 < config.yaml\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\" with "
"the configuration from \"config.yaml\"."
msgstr ""
Expand Down
6 changes: 3 additions & 3 deletions po/he.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-18 08:40-0700\n"
"POT-Creation-Date: 2024-12-19 16:04-0700\n"
"PO-Revision-Date: 2022-03-10 15:11+0000\n"
"Last-Translator: Anonymous <[email protected]>\n"
"Language-Team: Hebrew <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -7672,10 +7672,10 @@ msgstr ""

#: lxc/storage_volume.go:2430
msgid ""
"lxc storage volume snapshot create default v1 snap0\n"
"lxc storage volume snapshot default v1 snap0\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\".\n"
"\n"
"lxc storage volume snapshot create default v1 snap0 < config.yaml\n"
"lxc storage volume snapshot default v1 snap0 < config.yaml\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\" with "
"the configuration from \"config.yaml\"."
msgstr ""
Expand Down
6 changes: 3 additions & 3 deletions po/hi.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-18 08:40-0700\n"
"POT-Creation-Date: 2024-12-19 16:04-0700\n"
"PO-Revision-Date: 2022-03-10 15:08+0000\n"
"Last-Translator: Anonymous <[email protected]>\n"
"Language-Team: Hindi <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -7671,10 +7671,10 @@ msgstr ""

#: lxc/storage_volume.go:2430
msgid ""
"lxc storage volume snapshot create default v1 snap0\n"
"lxc storage volume snapshot default v1 snap0\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\".\n"
"\n"
"lxc storage volume snapshot create default v1 snap0 < config.yaml\n"
"lxc storage volume snapshot default v1 snap0 < config.yaml\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\" with "
"the configuration from \"config.yaml\"."
msgstr ""
Expand Down
6 changes: 3 additions & 3 deletions po/id.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-18 08:40-0700\n"
"POT-Creation-Date: 2024-12-19 16:04-0700\n"
"PO-Revision-Date: 2022-03-10 15:07+0000\n"
"Last-Translator: Anonymous <[email protected]>\n"
"Language-Team: Indonesian <https://hosted.weblate.org/projects/linux-"
Expand Down Expand Up @@ -7671,10 +7671,10 @@ msgstr ""

#: lxc/storage_volume.go:2430
msgid ""
"lxc storage volume snapshot create default v1 snap0\n"
"lxc storage volume snapshot default v1 snap0\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\".\n"
"\n"
"lxc storage volume snapshot create default v1 snap0 < config.yaml\n"
"lxc storage volume snapshot default v1 snap0 < config.yaml\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\" with "
"the configuration from \"config.yaml\"."
msgstr ""
Expand Down
6 changes: 3 additions & 3 deletions po/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-18 08:40-0700\n"
"POT-Creation-Date: 2024-12-19 16:04-0700\n"
"PO-Revision-Date: 2022-03-10 15:07+0000\n"
"Last-Translator: Luigi Operoso <[email protected]>\n"
"Language-Team: Italian <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -8255,10 +8255,10 @@ msgstr ""

#: lxc/storage_volume.go:2430
msgid ""
"lxc storage volume snapshot create default v1 snap0\n"
"lxc storage volume snapshot default v1 snap0\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\".\n"
"\n"
"lxc storage volume snapshot create default v1 snap0 < config.yaml\n"
"lxc storage volume snapshot default v1 snap0 < config.yaml\n"
" Create a snapshot of \"v1\" in pool \"default\" called \"snap0\" with "
"the configuration from \"config.yaml\"."
msgstr ""
Expand Down
Loading

0 comments on commit 4df9163

Please sign in to comment.