当前位置: 首页>>代码示例>>Golang>>正文


Golang i18n.G函数代码示例

本文整理汇总了Golang中github.com/ubuntu-core/snappy/i18n.G函数的典型用法代码示例。如果您正苦于以下问题:Golang G函数的具体用法?Golang G怎么用?Golang G使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了G函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Execute

func (x *cmdShell) Execute(args []string) error {
	shellType := x.Positional.ShellType
	if shellType == "classic" {
		if !classic.Enabled() {
			return fmt.Errorf(i18n.G(`Classic dimension disabled on this system.
Use "sudo snappy enable-classic" to enable it.`))
		}

		// we need to re-exec if we do not run as root
		if os.Getuid() != 0 {
			if err := reexecWithSudo(); err != nil {
				return err
			}
		}

		fmt.Println(i18n.G(`Entering classic dimension`))
		fmt.Println(i18n.G(`

The home directory is shared between snappy and the classic dimension.
Run "exit" to leave the classic shell.
`))
		return classic.RunShell()
	}

	return fmt.Errorf(i18n.G("unsupported shell %v"), shellType)
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:26,代码来源:cmd_shell.go

示例2: Execute

func (c *cmdChanges) Execute([]string) error {

	if c.Positional.Id != "" {
		return c.showChange(c.Positional.Id)
	}

	cli := Client()
	changes, err := cli.Changes(client.ChangesAll)
	if err != nil {
		return err
	}

	if len(changes) == 0 {
		return fmt.Errorf(i18n.G("no changes found"))
	}

	sort.Sort(changesByTime(changes))

	w := tabWriter()

	fmt.Fprintf(w, i18n.G("ID\tStatus\tSpawn\tReady\tSummary\n"))
	for _, chg := range changes {
		spawnTime := chg.SpawnTime.UTC().Format(time.RFC3339)
		readyTime := chg.ReadyTime.UTC().Format(time.RFC3339)
		if chg.ReadyTime.IsZero() {
			readyTime = "-"
		}
		fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", chg.ID, chg.Status, spawnTime, readyTime, chg.Summary)
	}

	w.Flush()
	fmt.Fprintln(Stdout)

	return nil
}
开发者ID:dholbach,项目名称:snappy,代码行数:35,代码来源:cmd_changes.go

示例3: Execute

func (cmdList) Execute([]string) error {
	cli := Client()
	filter := client.SnapFilter{
		Sources: []string{"local"},
	}
	snaps, _, err := cli.FilterSnaps(filter)
	if err != nil {
		return err
	}

	if len(snaps) == 0 {
		return fmt.Errorf(i18n.G("no snaps found"))
	}

	sort.Sort(snapsByName(snaps))

	w := tabWriter()
	defer w.Flush()

	fmt.Fprintln(w, i18n.G("Name\tVersion\tDeveloper"))

	for _, snap := range snaps {
		fmt.Fprintf(w, "%s\t%s\t%s\n", snap.Name, snap.Version, snap.Developer)
	}

	return nil
}
开发者ID:dholbach,项目名称:snappy,代码行数:27,代码来源:cmd_list.go

示例4: update

func (inst *snapInstruction) update() (*state.Change, error) {
	flags := snappy.DoInstallGC
	if inst.LeaveOld {
		flags = 0
	}
	state := inst.overlord.State()
	state.Lock()
	msg := fmt.Sprintf(i18n.G("Refresh %q snap"), inst.pkg)
	if inst.Channel != "stable" && inst.Channel != "" {
		msg = fmt.Sprintf(i18n.G("Refresh %q snap from %q channel"), inst.pkg, inst.Channel)
	}
	chg := state.NewChange("refresh-snap", msg)
	ts, err := snapstateUpdate(state, inst.pkg, inst.Channel, inst.userID, flags)
	if err == nil {
		chg.AddAll(ts)
	}
	state.Unlock()
	if err != nil {
		return nil, err
	}

	state.EnsureBefore(0)

	return chg, nil
}
开发者ID:dholbach,项目名称:snappy,代码行数:25,代码来源:api.go

示例5: outputHWAccessForPkgname

func outputHWAccessForPkgname(pkgname string, writePaths []string) {
	if len(writePaths) == 0 {
		// TRANSLATORS: the %s is a pkgname
		fmt.Printf(i18n.G("'%s:' is not allowed to access additional hardware\n"), pkgname)
	} else {
		// TRANSLATORS: the %s is a pkgname, the second a comma separated list of paths
		fmt.Printf(i18n.G("%s: %s\n"), pkgname, strings.Join(writePaths, ", "))
	}
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:9,代码来源:cmd_hwinfo.go

示例6: init

func init() {
	_, err := parser.AddCommand("console",
		i18n.G("Run snappy console interface"),
		i18n.G("Run snappy console interface"),
		&cmdConsole{})
	if err != nil {
		logger.Panicf("Unable to console: %v", err)
	}
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:9,代码来源:cmd_console.go

示例7: init

func init() {
	arg, err := parser.AddCommand("shell",
		i18n.G("Run snappy shell interface"),
		i18n.G("Run snappy shell interface"),
		&cmdShell{})
	if err != nil {
		logger.Panicf("Unable to add shell command: %q", err)
	}
	addOptionDescription(arg, "shell-type", i18n.G("The type of shell you want"))
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:10,代码来源:cmd_shell.go

示例8: init

func init() {
	arg, err := parser.AddCommand("remove",
		i18n.G("Remove a snapp part"),
		i18n.G("Remove a snapp part"),
		&cmdRemove{})
	if err != nil {
		logger.Panicf("Unable to remove: %v", err)
	}
	addOptionDescription(arg, "no-gc", i18n.G("Do not clean up old versions of the package."))
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:10,代码来源:cmd_remove.go

示例9: init

func init() {
	arg, err := parser.AddCommand("hw-unassign",
		shortHWUnassignHelp,
		longHWUnassignHelp,
		&cmdHWUnassign{})
	if err != nil {
		logger.Panicf("Unable to hwunassign: %v", err)
	}
	addOptionDescription(arg, "package name", i18n.G("Remove hardware from a specific installed package"))
	addOptionDescription(arg, "device path", i18n.G("The hardware device path (e.g. /dev/ttyUSB0)"))
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:11,代码来源:cmd_hwunassign.go

示例10: init

func init() {
	arg, err := parser.AddCommand("policygen",
		i18n.G("Generate the apparmor policy"),
		i18n.G("Generate the apparmor policy"),
		&cmdPolicygen{})
	if err != nil {
		logger.Panicf("Unable to install: %v", err)
	}
	addOptionDescription(arg, "force", i18n.G("Force policy generation."))
	addOptionDescription(arg, "package.yaml path", i18n.G("The path to the package.yaml used to generate the apparmor policy."))
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:11,代码来源:cmd_policygen.go

示例11: init

func init() {
	_, err := parser.AddCommand("service",
		i18n.G("Query and modify snappy services"),
		i18n.G("Query and modify snappy services of locally-installed packages"),
		&cmdService{})

	if err != nil {
		logger.Panicf("Unable to service: %v", err)
	}

}
开发者ID:robert-ancell,项目名称:snapd,代码行数:11,代码来源:cmd_service.go

示例12: init

func init() {
	arg, err := parser.AddCommand("update",
		i18n.G("Update all installed parts"),
		i18n.G("Ensures system is running with latest parts"),
		&cmdUpdate{})
	if err != nil {
		logger.Panicf("Unable to update: %v", err)
	}
	addOptionDescription(arg, "no-gc", i18n.G("Do not clean up old versions of the package."))
	addOptionDescription(arg, "automatic-reboot", i18n.G("Reboot if necessary to be on the latest running system."))
}
开发者ID:pombredanne,项目名称:snappy-1,代码行数:11,代码来源:cmd_update.go

示例13: init

func init() {
	arg, err := parser.AddCommand("rollback",
		shortRollbackHelp,
		longRollbackHelp,
		&cmdRollback{})
	if err != nil {
		logger.Panicf("Unable to rollback: %v", err)
	}
	addOptionDescription(arg, "package name", i18n.G("The package to rollback "))
	addOptionDescription(arg, "version", i18n.G("The version to rollback to"))
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:11,代码来源:cmd_rollback.go

示例14: init

func init() {
	arg, err := parser.AddCommand("config",
		shortConfigHelp,
		longConfigHelp,
		&cmdConfig{})
	if err != nil {
		logger.Panicf("Unable to config: %v", err)
	}
	addOptionDescription(arg, "package name", i18n.G("Set configuration for a specific installed package"))
	addOptionDescription(arg, "config file", i18n.G("The configuration for the given file"))
}
开发者ID:alecu,项目名称:snappy,代码行数:11,代码来源:cmd_config.go

示例15: init

func init() {
	arg, err := parser.AddCommand("info",
		shortInfoHelp,
		longInfoHelp,
		&cmdInfo{})
	if err != nil {
		logger.Panicf("Unable to info: %v", err)
	}
	addOptionDescription(arg, "verbose", i18n.G("Provides more detailed information"))
	addOptionDescription(arg, "include-remote", i18n.G("Include information about packages from the snappy store"))
	addOptionDescription(arg, "package name", i18n.G("Provide information about a specific installed package"))
}
开发者ID:alecu,项目名称:snappy,代码行数:12,代码来源:cmd_info.go


注:本文中的github.com/ubuntu-core/snappy/i18n.G函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。