本文整理匯總了Golang中github.com/megamsys/megdc/handler.NewHandler函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewHandler函數的具體用法?Golang NewHandler怎麽用?Golang NewHandler使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NewHandler函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Run
func (c *AttachOneHost) Run(context *cmd.Context) error {
handler.FunSpin(cmd.Colorfy(handler.Logo, "green", "", "bold"), "", "installing")
w := handler.NewWrap(c)
w.IfNoneAddPackages(INSTALL_PACKAGES)
if h, err := handler.NewHandler(w); err != nil {
return err
} else if err := h.Run(); err != nil {
return err
}
return nil
}
示例2: Run
func (c *Megamreport) Run(context *cmd.Context) error {
handler.FunSpin(cmd.Colorfy(handler.Logo, "green", "", "bold"), "", "report")
w := handler.NewWrap(c)
w.IfNoneAddPackages(REPORT_PACKAGES)
if h, err := handler.NewHandler(w); err != nil {
return err
} else if err := h.Run(); err != nil {
return err
}
return nil
}
示例3: Run
func (c *Cephdatastore) Run(context *cmd.Context) error {
handler.FunSpin(cmd.Colorfy(handler.Logo, "green", "", "bold"), "", "install")
w := handler.NewWrap(c)
w.IfNoneAddPackages(CEPH_DATATSTORE)
if h, err := handler.NewHandler(w); err != nil {
return err
} else if err := h.Run(); err != nil {
return err
}
return nil
}
示例4: Run
func (c *Sshpass) Run(context *cmd.Context) error {
handler.FunSpin(cmd.Colorfy(handler.Logo, "green", "", "bold"), "", "auth")
w := handler.NewWrap(c)
w.IfNoneAddPackages(SSH_PASS)
if h, err := handler.NewHandler(w); err != nil {
return err
} else if err := h.Run(); err != nil {
return err
}
return nil
}
示例5: Run
func (c *Createnetwork) Run(context *cmd.Context) error {
handler.FunSpin(cmd.Colorfy(handler.Logo, "green", "", "bold"), "", "createnetwork")
w := handler.NewWrap(c)
w.IfNoneAddPackages(NETWORK_PACKAGES)
if h, err := handler.NewHandler(w); err != nil {
return err
} else if err := h.Run(); err != nil {
return err
}
return nil
}
示例6: Run
func (c *Megamreport) Run(context *cmd.Context) error {
handler.FunSpin(cmd.Colorfy(handler.Logo, "green", "", "bold"), "")
packages := make(map[string]string)
options := make(map[string]string)
packages["MegamReport"] = "MegamReport"
if handler, err := handler.NewHandler(); err != nil {
return err
} else {
handler.SetTemplates(packages, options)
err := handler.Run()
if err != nil {
return err
}
}
// goodbye.
return nil
}
示例7: Run
func (c *Bridge) Run(context *cmd.Context) error {
fmt.Println("[main] starting megdc ...")
packages := make(map[string]string)
options := make(map[string]string)
s := reflect.ValueOf(c).Elem()
typ := s.Type()
if s.Kind() == reflect.Struct {
for i := 0; i < s.NumField(); i++ {
key := s.Field(i)
value := s.FieldByName(typ.Field(i).Name)
switch key.Interface().(type) {
case bool:
if value.Bool() {
packages[typ.Field(i).Name] = typ.Field(i).Name
}
case string:
if value.String() != "" {
options[typ.Field(i).Name] = value.String()
}
}
}
}
if handler, err := handler.NewHandler(); err != nil {
return err
} else {
handler.SetTemplates(packages, options)
err := handler.Run()
if err != nil {
return err
}
}
// goodbye.
return nil
}
示例8: Run
func (c *Megaminstall) Run(context *cmd.Context) error {
handler.FunSpin(cmd.Colorfy(handler.Logo, "green", "", "bold"), "")
packages := make(map[string]string)
options := make(map[string]string)
s := reflect.ValueOf(c).Elem()
typ := s.Type()
if s.Kind() == reflect.Struct {
for i := 0; i < s.NumField(); i++ {
key := s.Field(i)
value := s.FieldByName(typ.Field(i).Name)
switch key.Interface().(type) {
case bool:
if value.Bool() {
packages[typ.Field(i).Name] = typ.Field(i).Name
}
case string:
if value.String() != "" {
options[typ.Field(i).Name] = value.String()
}
}
}
}
if handler, err := handler.NewHandler(); err != nil {
return err
} else {
handler.SetTemplates(packages, options)
err := handler.Run()
if err != nil {
return err
}
}
// goodbye.
return nil
}