本文整理匯總了Golang中github.com/sqp/godock/libs/cdtype.Logger.ExecShlex方法的典型用法代碼示例。如果您正苦於以下問題:Golang Logger.ExecShlex方法的具體用法?Golang Logger.ExecShlex怎麽用?Golang Logger.ExecShlex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/sqp/godock/libs/cdtype.Logger
的用法示例。
在下文中一共展示了Logger.ExecShlex方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: LaunchCommand
func (o *dockIcon) LaunchCommand(log cdtype.Logger, args ...string) bool {
cmd := o.GetCommand()
switch {
case cmd == "":
case cmd[0] == '<': // Launch as shortkey.
success := shortkeys.Trigger(cmd)
if success {
return true
}
// try also as exec.
exec, e := log.ExecShlex(cmd, args...)
if log.Err(e, "parse command", cmd) {
return false
}
e = exec.Run()
return e == nil
default: // Exec command.
exec, e := log.ExecShlex(cmd, args...)
if log.Err(e, "parse command", cmd) {
return false
}
e = exec.Run()
if log.Err(e, "launch command", cmd, strings.Join(args, " ")) {
// try also as shortkey.
return shortkeys.Trigger(cmd)
}
return true
}
return false
}