Merge lp:~mvo/snappy/snappy-i18n-for-go-flags into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by Michael Vogt
Status: Merged
Approved by: John Lenton
Approved revision: 572
Merged at revision: 604
Proposed branch: lp:~mvo/snappy/snappy-i18n-for-go-flags
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Diff against target: 696 lines (+226/-47)
18 files modified
cmd/snappy/cmd_build.go (+2/-1)
cmd/snappy/cmd_config.go (+5/-3)
cmd/snappy/cmd_hwassign.go (+5/-3)
cmd/snappy/cmd_hwinfo.go (+3/-2)
cmd/snappy/cmd_hwunassign.go (+5/-3)
cmd/snappy/cmd_info.go (+5/-3)
cmd/snappy/cmd_install.go (+9/-5)
cmd/snappy/cmd_list.go (+4/-2)
cmd/snappy/cmd_login.go (+3/-2)
cmd/snappy/cmd_purge.go (+3/-2)
cmd/snappy/cmd_remove.go (+3/-2)
cmd/snappy/cmd_rollback.go (+5/-3)
cmd/snappy/cmd_search.go (+2/-1)
cmd/snappy/cmd_set_test.go (+0/-10)
cmd/snappy/cmd_update.go (+5/-3)
cmd/snappy/common.go (+27/-1)
cmd/snappy/common_test.go (+76/-0)
po/snappy.pot (+64/-1)
To merge this branch: bzr merge lp:~mvo/snappy/snappy-i18n-for-go-flags
Reviewer Review Type Date Requested Status
John Lenton (community) Approve
Review via email: mp+264112@code.launchpad.net

Commit message

Make all go-flag options translatable.

Description of the change

This branch makes all the go-flag optios we use translatable. Its a bit ugly because we need to iterate over the options for each command to find the right one, but AFAICT this is the only way with go-flags.

To post a comment you must log in.
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

looks good, one small itsy bitsy iota of a problem

Revision history for this message
Michael Vogt (mvo) wrote :

I'm happy to remove the "orPanic()", breakage should be very obvious as this is all called in init() so if there is a typo on first program start we get the panic.

571. By Michael Vogt

rename addOptionDescriptionOrPanic to addOptionDescription (it will still panic if the long option is not found). thanks Sergio!

Revision history for this message
Michael Vogt (mvo) wrote :

The branch is now updated and does not use "orPanic()" anymore.

572. By Michael Vogt

cmd/snappy/cmd_update.go: fix incorrect copy/paste

Revision history for this message
John Lenton (chipaca) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmd/snappy/cmd_build.go'
2--- cmd/snappy/cmd_build.go 2015-07-01 14:56:49 +0000
3+++ cmd/snappy/cmd_build.go 2015-07-24 09:37:45 +0000
4@@ -30,7 +30,7 @@
5 const clickReview = "click-review"
6
7 type cmdBuild struct {
8- Output string `long:"output" short:"o" description:"Specify an alternate output directory for the resulting package"`
9+ Output string `long:"output" short:"o"`
10 }
11
12 var longBuildHelp = i18n.G("Creates a snap package and if available, runs the review scripts.")
13@@ -45,6 +45,7 @@
14 }
15
16 cmd.Aliases = append(cmd.Aliases, "bu")
17+ addOptionDescription(cmd, "output", i18n.G("Specify an alternate output directory for the resulting package"))
18 }
19
20 func (x *cmdBuild) Execute(args []string) (err error) {
21
22=== modified file 'cmd/snappy/cmd_config.go'
23--- cmd/snappy/cmd_config.go 2015-07-01 14:56:49 +0000
24+++ cmd/snappy/cmd_config.go 2015-07-24 09:37:45 +0000
25@@ -32,8 +32,8 @@
26
27 type cmdConfig struct {
28 Positional struct {
29- PackageName string `positional-arg-name:"package name" description:"Set configuration for a specific installed package"`
30- ConfigFile string `positional-arg-name:"config file" description:"The configuration for the given file"`
31+ PackageName string `positional-arg-name:"package name"`
32+ ConfigFile string `positional-arg-name:"config file"`
33 } `positional-args:"yes"`
34 }
35
36@@ -42,13 +42,15 @@
37 var longConfigHelp = i18n.G("Configures a package. The configuration is a YAML file, provided in the specified file which can be \"-\" for stdin. Output of the command is the current configuration, so running this command with no input file provides a snapshot of the app's current config.")
38
39 func init() {
40- _, err := parser.AddCommand("config",
41+ arg, err := parser.AddCommand("config",
42 shortConfigHelp,
43 longConfigHelp,
44 &cmdConfig{})
45 if err != nil {
46 logger.Panicf("Unable to config: %v", err)
47 }
48+ addOptionDescription(arg, "package name", i18n.G("Set configuration for a specific installed package"))
49+ addOptionDescription(arg, "config file", i18n.G("The configuration for the given file"))
50 }
51
52 func (x *cmdConfig) Execute(args []string) (err error) {
53
54=== modified file 'cmd/snappy/cmd_hwassign.go'
55--- cmd/snappy/cmd_hwassign.go 2015-07-02 17:16:11 +0000
56+++ cmd/snappy/cmd_hwassign.go 2015-07-24 09:37:45 +0000
57@@ -29,8 +29,8 @@
58
59 type cmdHWAssign struct {
60 Positional struct {
61- PackageName string `positional-arg-name:"package name" description:"Assign hardware to a specific installed package"`
62- DevicePath string `positional-arg-name:"device path" description:"The hardware device path (e.g. /dev/ttyUSB0)"`
63+ PackageName string `positional-arg-name:"package name"`
64+ DevicePath string `positional-arg-name:"device path"`
65 } `required:"true" positional-args:"yes"`
66 }
67
68@@ -39,13 +39,15 @@
69 var longHWAssignHelp = i18n.G("This command adds access to a specific hardware device (e.g. /dev/ttyUSB0) for an installed package.")
70
71 func init() {
72- _, err := parser.AddCommand("hw-assign",
73+ arg, err := parser.AddCommand("hw-assign",
74 shortHWAssignHelp,
75 longHWAssignHelp,
76 &cmdHWAssign{})
77 if err != nil {
78 logger.Panicf("Unable to hwassign: %v", err)
79 }
80+ addOptionDescription(arg, "package name", i18n.G("Assign hardware to a specific installed package"))
81+ addOptionDescription(arg, "device path", i18n.G("The hardware device path (e.g. /dev/ttyUSB0)"))
82 }
83
84 func (x *cmdHWAssign) Execute(args []string) error {
85
86=== modified file 'cmd/snappy/cmd_hwinfo.go'
87--- cmd/snappy/cmd_hwinfo.go 2015-07-01 14:56:49 +0000
88+++ cmd/snappy/cmd_hwinfo.go 2015-07-24 09:37:45 +0000
89@@ -30,7 +30,7 @@
90
91 type cmdHWInfo struct {
92 Positional struct {
93- PackageName string `positional-arg-name:"package name" description:"List assigned hardware for a specific installed package"`
94+ PackageName string `positional-arg-name:"package name"`
95 } `positional-args:"yes"`
96 }
97
98@@ -39,13 +39,14 @@
99 var longHWInfoHelp = i18n.G("This command list what hardware an installed package can access")
100
101 func init() {
102- _, err := parser.AddCommand("hw-info",
103+ arg, err := parser.AddCommand("hw-info",
104 shortHWInfoHelp,
105 longHWInfoHelp,
106 &cmdHWInfo{})
107 if err != nil {
108 logger.Panicf("Unable to hwinfo: %v", err)
109 }
110+ addOptionDescription(arg, "package name", i18n.G("List assigned hardware for a specific installed package"))
111 }
112
113 func outputHWAccessForPkgname(pkgname string, writePaths []string) {
114
115=== modified file 'cmd/snappy/cmd_hwunassign.go'
116--- cmd/snappy/cmd_hwunassign.go 2015-07-02 15:22:28 +0000
117+++ cmd/snappy/cmd_hwunassign.go 2015-07-24 09:37:45 +0000
118@@ -29,8 +29,8 @@
119
120 type cmdHWUnassign struct {
121 Positional struct {
122- PackageName string `positional-arg-name:"package name" description:"Remove hardware from a specific installed package"`
123- DevicePath string `positional-arg-name:"device path" description:"The hardware device path (e.g. /dev/ttyUSB0)"`
124+ PackageName string `positional-arg-name:"package name"`
125+ DevicePath string `positional-arg-name:"device path"`
126 } `required:"true" positional-args:"yes"`
127 }
128
129@@ -39,13 +39,15 @@
130 var longHWUnassignHelp = i18n.G("This command removes access of a specific hardware device (e.g. /dev/ttyUSB0) for an installed package.")
131
132 func init() {
133- _, err := parser.AddCommand("hw-unassign",
134+ arg, err := parser.AddCommand("hw-unassign",
135 shortHWUnassignHelp,
136 longHWUnassignHelp,
137 &cmdHWUnassign{})
138 if err != nil {
139 logger.Panicf("Unable to hwunassign: %v", err)
140 }
141+ addOptionDescription(arg, "package name", i18n.G("Remove hardware from a specific installed package"))
142+ addOptionDescription(arg, "device path", i18n.G("The hardware device path (e.g. /dev/ttyUSB0)"))
143 }
144
145 func (x *cmdHWUnassign) Execute(args []string) error {
146
147=== modified file 'cmd/snappy/cmd_info.go'
148--- cmd/snappy/cmd_info.go 2015-07-01 14:56:49 +0000
149+++ cmd/snappy/cmd_info.go 2015-07-24 09:37:45 +0000
150@@ -30,9 +30,9 @@
151 )
152
153 type cmdInfo struct {
154- Verbose bool `short:"v" long:"verbose" description:"Provides more detailed information"`
155+ Verbose bool `short:"v" long:"verbose"`
156 Positional struct {
157- PackageName string `positional-arg-name:"package name" description:"Provide information about a specific installed package"`
158+ PackageName string `positional-arg-name:"package name"`
159 } `positional-args:"yes"`
160 }
161
162@@ -48,13 +48,15 @@
163 The verbose version of the info command for a package will also tell you the available channels for that package, when it was installed for the first time, disk space utilization, and in the case of frameworks, which apps are able to use the framework.`)
164
165 func init() {
166- _, err := parser.AddCommand("info",
167+ arg, err := parser.AddCommand("info",
168 shortInfoHelp,
169 longInfoHelp,
170 &cmdInfo{})
171 if err != nil {
172 logger.Panicf("Unable to info: %v", err)
173 }
174+ addOptionDescription(arg, "verbose", i18n.G("Provides more detailed information"))
175+ addOptionDescription(arg, "package name", i18n.G("Provide information about a specific installed package"))
176 }
177
178 func (x *cmdInfo) Execute(args []string) (err error) {
179
180=== modified file 'cmd/snappy/cmd_install.go'
181--- cmd/snappy/cmd_install.go 2015-07-01 14:56:49 +0000
182+++ cmd/snappy/cmd_install.go 2015-07-24 09:37:45 +0000
183@@ -31,22 +31,26 @@
184 )
185
186 type cmdInstall struct {
187- AllowUnauthenticated bool `long:"allow-unauthenticated" description:"Install snaps even if the signature can not be verified."`
188- DisableGC bool `long:"no-gc" description:"Do not clean up old versions of the package."`
189+ AllowUnauthenticated bool `long:"allow-unauthenticated"`
190+ DisableGC bool `long:"no-gc"`
191 Positional struct {
192- PackageName string `positional-arg-name:"package name" description:"The Package to install (name or path)"`
193- ConfigFile string `positional-arg-name:"config file" description:"The configuration for the given install"`
194+ PackageName string `positional-arg-name:"package name"`
195+ ConfigFile string `positional-arg-name:"config file"`
196 } `positional-args:"yes"`
197 }
198
199 func init() {
200- _, err := parser.AddCommand("install",
201+ arg, err := parser.AddCommand("install",
202 i18n.G("Install a snap package"),
203 i18n.G("Install a snap package"),
204 &cmdInstall{})
205 if err != nil {
206 logger.Panicf("Unable to install: %v", err)
207 }
208+ addOptionDescription(arg, "allow-unauthenticated", i18n.G("Install snaps even if the signature can not be verified."))
209+ addOptionDescription(arg, "no-gc", i18n.G("Do not clean up old versions of the package."))
210+ addOptionDescription(arg, "package name", i18n.G("The Package to install (name or path)"))
211+ addOptionDescription(arg, "config file", i18n.G("The configuration for the given install"))
212 }
213
214 func (x *cmdInstall) Execute(args []string) error {
215
216=== modified file 'cmd/snappy/cmd_list.go'
217--- cmd/snappy/cmd_list.go 2015-07-02 17:16:11 +0000
218+++ cmd/snappy/cmd_list.go 2015-07-24 09:37:45 +0000
219@@ -33,8 +33,8 @@
220 )
221
222 type cmdList struct {
223- Updates bool `short:"u" long:"updates" description:"Show available updates (requires network)"`
224- Verbose bool `short:"v" long:"verbose" description:"Show channel information and expand all fields"`
225+ Updates bool `short:"u" long:"updates"`
226+ Verbose bool `short:"v" long:"verbose"`
227 }
228
229 var shortListHelp = i18n.G("List active components installed on a snappy system")
230@@ -57,6 +57,8 @@
231 }
232
233 cmd.Aliases = append(cmd.Aliases, "li")
234+ addOptionDescription(cmd, "updates", i18n.G("Show available updates (requires network)"))
235+ addOptionDescription(cmd, "verbose", i18n.G("Show channel information and expand all fields"))
236 }
237
238 func (x *cmdList) Execute(args []string) (err error) {
239
240=== modified file 'cmd/snappy/cmd_login.go'
241--- cmd/snappy/cmd_login.go 2015-06-30 12:52:52 +0000
242+++ cmd/snappy/cmd_login.go 2015-07-24 09:37:45 +0000
243@@ -33,7 +33,7 @@
244
245 type cmdLogin struct {
246 Positional struct {
247- UserName string `positional-arg-name:"userid" description:"Username for the login"`
248+ UserName string `positional-arg-name:"userid"`
249 } `positional-args:"yes" required:"yes"`
250 }
251
252@@ -42,13 +42,14 @@
253 var longLoginHelp = i18n.G("This command logs the given username into the store")
254
255 func init() {
256- _, err := parser.AddCommand("login",
257+ arg, err := parser.AddCommand("login",
258 shortLoginHelp,
259 longLoginHelp,
260 &cmdLogin{})
261 if err != nil {
262 logger.Panicf("Unable to login: %v", err)
263 }
264+ addOptionDescription(arg, "userid", i18n.G("Username for the login"))
265 }
266
267 func requestStoreTokenWith2faRetry(username, password, tokenName string) (*snappy.StoreToken, error) {
268
269=== modified file 'cmd/snappy/cmd_purge.go'
270--- cmd/snappy/cmd_purge.go 2015-07-01 14:56:49 +0000
271+++ cmd/snappy/cmd_purge.go 2015-07-24 09:37:45 +0000
272@@ -29,7 +29,7 @@
273 )
274
275 type cmdPurge struct {
276- Installed bool `long:"installed" description:"Purge an installed package."`
277+ Installed bool `long:"installed"`
278 }
279
280 var (
281@@ -38,13 +38,14 @@
282 )
283
284 func init() {
285- _, err := parser.AddCommand("purge",
286+ arg, err := parser.AddCommand("purge",
287 shortPurgeHelp,
288 longPurgeHelp,
289 &cmdPurge{})
290 if err != nil {
291 logger.Panicf("Unable to purge: %v", err)
292 }
293+ addOptionDescription(arg, "installed", i18n.G("Purge an installed package."))
294 }
295
296 func (x *cmdPurge) Execute(args []string) error {
297
298=== modified file 'cmd/snappy/cmd_remove.go'
299--- cmd/snappy/cmd_remove.go 2015-07-01 14:56:49 +0000
300+++ cmd/snappy/cmd_remove.go 2015-07-24 09:37:45 +0000
301@@ -29,17 +29,18 @@
302 )
303
304 type cmdRemove struct {
305- DisableGC bool `long:"no-gc" description:"Do not clean up old versions of the package."`
306+ DisableGC bool `long:"no-gc"`
307 }
308
309 func init() {
310- _, err := parser.AddCommand("remove",
311+ arg, err := parser.AddCommand("remove",
312 i18n.G("Remove a snapp part"),
313 i18n.G("Remove a snapp part"),
314 &cmdRemove{})
315 if err != nil {
316 logger.Panicf("Unable to remove: %v", err)
317 }
318+ addOptionDescription(arg, "no-gc", i18n.G("Do not clean up old versions of the package."))
319 }
320
321 func (x *cmdRemove) Execute(args []string) (err error) {
322
323=== modified file 'cmd/snappy/cmd_rollback.go'
324--- cmd/snappy/cmd_rollback.go 2015-07-02 17:16:11 +0000
325+++ cmd/snappy/cmd_rollback.go 2015-07-24 09:37:45 +0000
326@@ -31,8 +31,8 @@
327
328 type cmdRollback struct {
329 Positional struct {
330- PackageName string `positional-arg-name:"package name" description:"The package to rollback "`
331- Version string `positional-arg-name:"version" description:"The version to rollback to"`
332+ PackageName string `positional-arg-name:"package name"`
333+ Version string `positional-arg-name:"version"`
334 } `positional-args:"yes"`
335 }
336
337@@ -41,13 +41,15 @@
338 var longRollbackHelp = i18n.G("Allows rollback of a snap to a previous installed version. Without any arguments, the previous installed version is selected. It is also possible to specify the version to rollback to as a additional argument.\n")
339
340 func init() {
341- _, err := parser.AddCommand("rollback",
342+ arg, err := parser.AddCommand("rollback",
343 shortRollbackHelp,
344 longRollbackHelp,
345 &cmdRollback{})
346 if err != nil {
347 logger.Panicf("Unable to rollback: %v", err)
348 }
349+ addOptionDescription(arg, "package name", i18n.G("The package to rollback "))
350+ addOptionDescription(arg, "version", i18n.G("The version to rollback to"))
351 }
352
353 func (x *cmdRollback) Execute(args []string) (err error) {
354
355=== modified file 'cmd/snappy/cmd_search.go'
356--- cmd/snappy/cmd_search.go 2015-07-01 14:56:49 +0000
357+++ cmd/snappy/cmd_search.go 2015-07-24 09:37:45 +0000
358@@ -31,7 +31,7 @@
359 )
360
361 type cmdSearch struct {
362- ShowAll bool `long:"show-all" description:"Show all available forks of a package"`
363+ ShowAll bool `long:"show-all"`
364 }
365
366 func init() {
367@@ -44,6 +44,7 @@
368 }
369
370 cmd.Aliases = append(cmd.Aliases, "se")
371+ addOptionDescription(cmd, "show-all", i18n.G("Show all available forks of a package"))
372 }
373
374 func (x *cmdSearch) Execute(args []string) (err error) {
375
376=== modified file 'cmd/snappy/cmd_set_test.go'
377--- cmd/snappy/cmd_set_test.go 2015-06-02 20:53:10 +0000
378+++ cmd/snappy/cmd_set_test.go 2015-07-24 09:37:45 +0000
379@@ -20,19 +20,9 @@
380 package main
381
382 import (
383- "testing"
384-
385 . "gopkg.in/check.v1"
386 )
387
388-// Hook up check.v1 into the "go test" runner
389-func Test(t *testing.T) { TestingT(t) }
390-
391-type CmdTestSuite struct {
392-}
393-
394-var _ = Suite(&CmdTestSuite{})
395-
396 func (s *CmdTestSuite) TestParseSetPropertyCmdline(c *C) {
397
398 // simple case
399
400=== modified file 'cmd/snappy/cmd_update.go'
401--- cmd/snappy/cmd_update.go 2015-07-01 14:56:49 +0000
402+++ cmd/snappy/cmd_update.go 2015-07-24 09:37:45 +0000
403@@ -32,18 +32,20 @@
404 )
405
406 type cmdUpdate struct {
407- DisableGC bool `long:"no-gc" description:"Do not clean up old versions of the package."`
408- AutoReboot bool `long:"automatic-reboot" description:"Reboot if necessary to be on the latest running system."`
409+ DisableGC bool `long:"no-gc"`
410+ AutoReboot bool `long:"automatic-reboot"`
411 }
412
413 func init() {
414- _, err := parser.AddCommand("update",
415+ arg, err := parser.AddCommand("update",
416 i18n.G("Update all installed parts"),
417 i18n.G("Ensures system is running with latest parts"),
418 &cmdUpdate{})
419 if err != nil {
420 logger.Panicf("Unable to update: %v", err)
421 }
422+ addOptionDescription(arg, "no-gc", i18n.G("Do not clean up old versions of the package."))
423+ addOptionDescription(arg, "automatic-reboot", i18n.G("Reboot if necessary to be on the latest running system."))
424 }
425
426 const (
427
428=== modified file 'cmd/snappy/common.go'
429--- cmd/snappy/common.go 2015-06-15 07:38:57 +0000
430+++ cmd/snappy/common.go 2015-07-24 09:37:45 +0000
431@@ -19,7 +19,12 @@
432
433 package main
434
435-import "launchpad.net/snappy/priv"
436+import (
437+ "launchpad.net/snappy/logger"
438+ "launchpad.net/snappy/priv"
439+
440+ "github.com/jessevdk/go-flags"
441+)
442
443 const snappyLockFile = "/run/snappy.lock"
444
445@@ -27,3 +32,24 @@
446 func withMutex(f func() error) error {
447 return priv.WithMutex(snappyLockFile, f)
448 }
449+
450+// addOptionDescription will try to find the given longName in the
451+// options and arguments of the given Command and add a description
452+//
453+// if the longName is not found it will panic
454+func addOptionDescription(arg *flags.Command, longName, description string) {
455+ for _, opt := range arg.Options() {
456+ if opt.LongName == longName {
457+ opt.Description = description
458+ return
459+ }
460+ }
461+ for _, opt := range arg.Args() {
462+ if opt.Name == longName {
463+ opt.Description = description
464+ return
465+ }
466+ }
467+
468+ logger.Panicf("can not set option description for %#v", longName)
469+}
470
471=== added file 'cmd/snappy/common_test.go'
472--- cmd/snappy/common_test.go 1970-01-01 00:00:00 +0000
473+++ cmd/snappy/common_test.go 2015-07-24 09:37:45 +0000
474@@ -0,0 +1,76 @@
475+// -*- Mode: Go; indent-tabs-mode: t -*-
476+
477+/*
478+ * Copyright (C) 2014-2015 Canonical Ltd
479+ *
480+ * This program is free software: you can redistribute it and/or modify
481+ * it under the terms of the GNU General Public License version 3 as
482+ * published by the Free Software Foundation.
483+ *
484+ * This program is distributed in the hope that it will be useful,
485+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
486+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
487+ * GNU General Public License for more details.
488+ *
489+ * You should have received a copy of the GNU General Public License
490+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
491+ *
492+ */
493+
494+package main
495+
496+import (
497+ "testing"
498+
499+ "github.com/jessevdk/go-flags"
500+
501+ . "gopkg.in/check.v1"
502+)
503+
504+// Hook up check.v1 into the "go test" runner
505+func Test(t *testing.T) { TestingT(t) }
506+
507+type CmdTestSuite struct {
508+}
509+
510+var _ = Suite(&CmdTestSuite{})
511+
512+func (s *CmdTestSuite) TestAddOptionDescriptionOrPanicForOption(c *C) {
513+ type cmdMock struct {
514+ Verbose bool `short:"v" long:"verbose"`
515+ }
516+
517+ parser := flags.NewParser(&struct{}{}, 0)
518+ arg, err := parser.AddCommand("mock", "shortHelp", "longHelp", &cmdMock{})
519+ c.Assert(err, IsNil)
520+ c.Assert(arg.Options()[0].LongName, Equals, "verbose")
521+ c.Assert(arg.Options()[0].Description, Equals, "")
522+ addOptionDescription(arg, "verbose", "verbose description")
523+ c.Assert(arg.Options()[0].Description, Equals, "verbose description")
524+}
525+
526+func (s *CmdTestSuite) TestAddOptionDescriptionOrPanicForPositional(c *C) {
527+ type cmdMock struct {
528+ Positional struct {
529+ PackageName string `positional-arg-name:"package name"`
530+ } `positional-args:"yes"`
531+ }
532+
533+ parser := flags.NewParser(&struct{}{}, 0)
534+ arg, err := parser.AddCommand("mock", "shortHelp", "longHelp", &cmdMock{})
535+ c.Assert(err, IsNil)
536+ c.Assert(arg.Args()[0].Name, Equals, "package name")
537+ c.Assert(arg.Args()[0].Description, Equals, "")
538+ addOptionDescription(arg, "package name", "pkgname description")
539+ c.Assert(arg.Args()[0].Description, Equals, "pkgname description")
540+}
541+
542+func (s *CmdTestSuite) TestAddOptionDescriptionOrPanicWillPanic(c *C) {
543+ parser := flags.NewParser(&struct{}{}, 0)
544+ arg, err := parser.AddCommand("mock", "shortHelp", "longHelp", &struct{}{})
545+ c.Assert(err, IsNil)
546+ f := func() {
547+ addOptionDescription(arg, "package name", "pkgname description")
548+ }
549+ c.Assert(f, PanicMatches, "can not set option description for \"package name\"")
550+}
551
552=== modified file 'po/snappy.pot'
553--- po/snappy.pot 2015-07-02 17:16:11 +0000
554+++ po/snappy.pot 2015-07-24 09:37:45 +0000
555@@ -7,7 +7,7 @@
556 msgid ""
557 msgstr "Project-Id-Version: snappy\n"
558 "Report-Msgid-Bugs-To: snappy-devel@lists.ubuntu.com\n"
559- "POT-Creation-Date: 2015-07-02 11:15-0600\n"
560+ "POT-Creation-Date: 2015-07-08 10:00+0200\n"
561 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
562 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
563 "Language-Team: LANGUAGE <LL@li.org>\n"
564@@ -61,6 +61,9 @@
565 msgid "Assign a hardware device to a package"
566 msgstr ""
567
568+msgid "Assign hardware to a specific installed package"
569+msgstr ""
570+
571 msgid "Builds a snap package"
572 msgstr ""
573
574@@ -80,6 +83,9 @@
575 msgid "Display a summary of key attributes of the snappy system."
576 msgstr ""
577
578+msgid "Do not clean up old versions of the package."
579+msgstr ""
580+
581 msgid "Ensures system is running with latest parts"
582 msgstr ""
583
584@@ -94,6 +100,9 @@
585 msgid "Install a snap package"
586 msgstr ""
587
588+msgid "Install snaps even if the signature can not be verified."
589+msgstr ""
590+
591 #. TRANSLATORS: the %s is a pkgname
592 #, c-format
593 msgid "Installing %s\n"
594@@ -105,6 +114,9 @@
595 msgid "List assigned hardware device for a package"
596 msgstr ""
597
598+msgid "List assigned hardware for a specific installed package"
599+msgstr ""
600+
601 msgid "Log into the store"
602 msgstr ""
603
604@@ -128,6 +140,15 @@
605 msgid "Password: "
606 msgstr ""
607
608+msgid "Provide information about a specific installed package"
609+msgstr ""
610+
611+msgid "Provides more detailed information"
612+msgstr ""
613+
614+msgid "Purge an installed package."
615+msgstr ""
616+
617 #. TRANSLATORS: the %s is a pkgname
618 #, c-format
619 msgid "Purging %s\n"
620@@ -136,6 +157,9 @@
621 msgid "Query the store for available packages"
622 msgstr ""
623
624+msgid "Reboot if necessary to be on the latest running system."
625+msgstr ""
626+
627 #. TRANSLATORS: the first %s is a pkgname the second a version
628 #, c-format
629 msgid "Reboot to use %s version %s."
630@@ -158,6 +182,9 @@
631 msgid "Remove all the data from the listed packages"
632 msgstr ""
633
634+msgid "Remove hardware from a specific installed package"
635+msgstr ""
636+
637 #. TRANSLATORS: the %s is a pkgname
638 #, c-format
639 msgid "Removing %s\n"
640@@ -169,6 +196,9 @@
641 msgid "Search for packages to install"
642 msgstr ""
643
644+msgid "Set configuration for a specific installed package"
645+msgstr ""
646+
647 msgid "Set configuration for an installed package."
648 msgstr ""
649
650@@ -180,6 +210,36 @@
651 msgid "Setting %s to version %s\n"
652 msgstr ""
653
654+msgid "Show all available forks of a package"
655+msgstr ""
656+
657+msgid "Show available updates (requires network)"
658+msgstr ""
659+
660+msgid "Show channel information and expand all fields"
661+msgstr ""
662+
663+msgid "Specify an alternate output directory for the resulting package"
664+msgstr ""
665+
666+msgid "The Package to install (name or path)"
667+msgstr ""
668+
669+msgid "The configuration for the given file"
670+msgstr ""
671+
672+msgid "The configuration for the given install"
673+msgstr ""
674+
675+msgid "The hardware device path (e.g. /dev/ttyUSB0)"
676+msgstr ""
677+
678+msgid "The package to rollback "
679+msgstr ""
680+
681+msgid "The version to rollback to"
682+msgstr ""
683+
684 msgid "This command adds access to a specific hardware device (e.g. /dev/"
685 "ttyUSB0) for an installed package."
686 msgstr ""
687@@ -206,6 +266,9 @@
688 msgid "Use --show-all to see all available forks."
689 msgstr ""
690
691+msgid "Username for the login"
692+msgstr ""
693+
694 #. TRANSLATORS: the %s represents a list of installed appnames
695 #. (e.g. "apps: foo, bar, baz")
696 #, c-format

Subscribers

People subscribed via source and target branches