本文整理匯總了Golang中github.com/eris-ltd/eris-cli/definitions.Do.Args方法的典型用法代碼示例。如果您正苦於以下問題:Golang Do.Args方法的具體用法?Golang Do.Args怎麽用?Golang Do.Args使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/eris-ltd/eris-cli/definitions.Do
的用法示例。
在下文中一共展示了Do.Args方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: PlopChain
func PlopChain(do *definitions.Do) error {
do.Name = do.ChainID
rootDir := path.Join("/home/eris/.eris/blockchains", do.ChainID)
switch do.Type {
case "genesis":
do.Args = []string{"cat", path.Join(rootDir, "genesis.json")}
case "config":
do.Args = []string{"cat", path.Join(rootDir, "config.toml")}
case "status":
do.Args = []string{"mintinfo", "--node-addr", "http://0.0.0.0:46657", "status"}
default:
return fmt.Errorf("unknown plop option %s", do.Type)
}
return ExecChain(do)
}
示例2: RmData
// TODO: skip errors flag
func RmData(do *definitions.Do) (err error) {
if len(do.Args) == 0 {
do.Args = []string{do.Name}
}
for _, name := range do.Args {
do.Name = name
if util.IsDataContainer(do.Name, do.Operations.ContainerNumber) {
logger.Infoln("Removing data container " + do.Name)
srv := definitions.BlankServiceDefinition()
srv.Operations.SrvContainerName = util.ContainersName("data", do.Name, do.Operations.ContainerNumber)
if err = perform.DockerRemove(srv.Service, srv.Operations, false); err != nil {
logger.Errorf("Error removing %s: %v", do.Name, err)
return err
}
} else {
err = fmt.Errorf("I cannot find that data container for %s. Please check the data container name you sent me.", do.Name)
logger.Errorln(err)
return err
}
if do.RmHF {
logger.Println("Removing host folder " + do.Name)
if err = os.RemoveAll(path.Join(DataContainersPath, do.Name)); err != nil {
return err
}
}
}
do.Result = "success"
return err
}
示例3: StartService
func StartService(do *definitions.Do) (err error) {
var services []*definitions.ServiceDefinition
cNum := do.Operations.ContainerNumber
if err != nil {
return err
}
do.Args = append(do.Args, do.ServicesSlice...)
logger.Debugf("Building the Services Group =>\t%v\n", do.Args)
for _, srv := range do.Args {
// this forces CLI/Agent level overwrites of the Operations.
// if this needs to get reversed, we should discuss on GH.
s, e := BuildServicesGroup(srv, cNum)
if e != nil {
return e
}
services = append(services, s...)
}
for _, s := range services {
//XXX does AutoMagic elim need for this?
util.OverWriteOperations(s.Operations, do.Operations)
}
services, err = BuildChainGroup(do.ChainName, services)
if err != nil {
return err
}
// TODO: move this wg, ch logic into func StartGroup([]*definitions.ServiceDefinition) error {}
wg, ch := new(sync.WaitGroup), make(chan error)
StartGroup(ch, wg, services)
go func() {
wg.Wait()
select {
case ch <- nil:
}
}()
if err := <-ch; err != nil {
return err
}
return nil
}
示例4: StartService
func StartService(do *definitions.Do) (err error) {
var services []*definitions.ServiceDefinition
cNum := do.Operations.ContainerNumber
do.Args = append(do.Args, do.ServicesSlice...)
logger.Infof("Building the Services Group =>\t%v\n", do.Args)
for _, srv := range do.Args {
s, e := BuildServicesGroup(srv, cNum)
if e != nil {
return e
}
services = append(services, s...)
}
for _, s := range services {
// XXX does AutoMagic elim need for this?
// [csk]: not totally we may need to have ops reconciliation, overwrite will, e.g., merge the maps and stuff
util.OverWriteOperations(s.Operations, do.Operations)
}
logger.Debugln("services before build chain")
for _, s := range services {
logger.Debugln("\t", s.Name, s.Dependencies, s.Service.Links, s.Service.VolumesFrom)
}
services, err = BuildChainGroup(do.ChainName, services)
if err != nil {
return err
}
logger.Debugln("services after build chain")
for _, s := range services {
logger.Debugln("\t", s.Name, s.Dependencies, s.Service.Links, s.Service.VolumesFrom)
}
// NOTE: the top level service should be at the end of the list
topService := services[len(services)-1]
topService.Service.Environment = append(topService.Service.Environment, do.Env...)
topService.Service.Links = append(topService.Service.Links, do.Links...)
services[len(services)-1] = topService
logger.Infof("Starting Services Group.\n")
return StartGroup(services)
}
示例5: ListKnown
func ListKnown(do *definitions.Do) error {
do.Args = util.DataContainerNames()
do.Result = strings.Join(do.Args, "\n")
return nil
}