// Register a command. It can't have been registered before. Safe to call on a
// running server.
359684
func (s *Server) Register(cmd string, f Cmd) error {
	s.mu.Lock()
	defer s.mu.Unlock()
	cmd = strings.ToUpper(cmd)
	if _, ok := s.cmds[cmd]; ok {
		return fmt.Errorf("command already registered: %s", cmd)
	}
	s.cmds[cmd] = f
	return nil
}
77698
func (cli *Client) Register(req *ReqRegister) (*RespRegister, *RespUserInteractive, error) {
	u := cli.BuildURL("register")
	return cli.register(u, req)
}
285272
func (cmd *ListBottleCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {
	var accountID int
	cc.Flags().IntVar(&cmd.AccountID, "accountID", accountID, `Account ID`)
	var years []int
	cc.Flags().IntSliceVar(&cmd.Years, "years", years, `Filter by years`)
}
474266
func Register(d *yarpc.Dispatcher) {
	ms := &service{d}
	d.Register(ms.Procedures())
}
1073261
func (c *Client) Register(procedure string, fn MethodHandler, options map[string]interface{}) error {
	id := NewID()
	c.registerListener(id)
	register := &Register{
		Request:   id,
		Options:   options,
		Procedure: URI(procedure),
	}
	if err := c.Send(register); err != nil {
		return err
	}

	// wait to receive REGISTERED message
	msg, err := c.waitOnListener(id)
	if err != nil {
		return err
	} else if e, ok := msg.(*Error); ok {
		return fmt.Errorf("error registering procedure '%v': %v", procedure, e.Error)
	} else if registered, ok := msg.(*Registered); !ok {
		return fmt.Errorf(formatUnexpectedMessage(msg, REGISTERED))
	} else {
		// register the event handler with this registration
		c.procedures[registered.Registration] = &procedureDesc{procedure, fn}
	}
	return nil
}
1112906
func (c *kregistry) Register(s *registry.Service, opts ...registry.RegisterOption) error {
	if len(s.Nodes) == 0 {
		return errors.New("you must register at least one node")
	}

	// TODO: grab podname from somewhere better than this.
	podName := os.Getenv("HOSTNAME")
	svcName := s.Name

	// encode micro service
	b, err := json.Marshal(s)
	if err != nil {
		return err
	}
	svc := string(b)

	pod := &client.Pod{
		Metadata: &client.Meta{
			Labels: map[string]*string{
				labelTypeKey:                             &labelTypeValueService,
				svcSelectorPrefix + serviceName(svcName): &svcSelectorValue,
			},
			Annotations: map[string]*string{
				annotationServiceKeyPrefix + serviceName(svcName): &svc,
			},
		},
	}

	if _, err := c.client.UpdatePod(podName, pod); err != nil {
		return err
	}

	return nil

}
157508
func (t *connTable) Register(ck ckey, matchedRule *Rule, srcIP, srcPort string, targetPort layers.TCPPort) {
	t.mtx.Lock()
	defer t.mtx.Unlock()

	if _, ok := t.table[ck]; ok {
		// TODO: wut?
	} else {
		logger.Debugf("[contable] registering %s:%s->%d", srcIP, srcPort, targetPort)

		t.table[ck] = &Metadata{
			Added:      time.Now(),
			Rule:       matchedRule,
			TargetPort: targetPort,
			//TargetIP:   targetIP,
		}
	}
}
228140
func (r *RemoteService) Register(comp component.Component, opts []component.Option) error {
	s := component.NewService(comp, opts)

	if _, ok := r.services[s.Name]; ok {
		return fmt.Errorf("remote: service already defined: %s", s.Name)
	}

	if err := s.ExtractRemote(); err != nil {
		return err
	}

	r.services[s.Name] = s
	// register all remotes
	for name, remote := range s.Remotes {
		remotes[fmt.Sprintf("%s.%s", s.Name, name)] = remote
	}

	return nil
}
1192227
func Register(s *grpc.Server, server queryservice.QueryService) {
	queryservicepb.RegisterQueryServer(s, &query{server})
}
1312065
func (s *Script) Register(bus *evbus.EventBus, context *context.Context) { //returns args and volumes to mount
	bus.Subscribe("artemide:start", Start)                                                  //Subscribing to artemide:start, Hello will be called
	bus.Subscribe("artemide:artifact:recipe:script:event:after_unpack", afterUnpackHandler) //Subscribing to artemide:artifact:recipe:script:event:after_unpack, the After unpack handler
}
126678
func (fl *Flags) Register(f *flag.FlagSet) {
	f.Var(&fl.TargetType, "ts-mon-target-type",
		"the type of target that is being monitored ("+targetTypeEnum.Choices()+")")
	f.StringVar(&fl.DeviceHostname, "ts-mon-device-hostname", fl.DeviceHostname,
		"name of this device")
	f.StringVar(&fl.DeviceRegion, "ts-mon-device-region", fl.DeviceRegion,
		"name of the region this devices lives in")
	f.StringVar(&fl.DeviceRole, "ts-mon-device-role", fl.DeviceRole,
		"role of the device")
	f.StringVar(&fl.DeviceNetwork, "ts-mon-device-network", fl.DeviceNetwork,
		"name of the network this device is connected to")
	f.StringVar(&fl.TaskServiceName, "ts-mon-task-service-name", fl.TaskServiceName,
		"name of the service being monitored")
	f.StringVar(&fl.TaskJobName, "ts-mon-task-job-name", fl.TaskJobName,
		"name of this job instance of the task")
	f.StringVar(&fl.TaskRegion, "ts-mon-task-region", fl.TaskRegion,
		"name of the region in which this task is running")
	f.StringVar(&fl.TaskHostname, "ts-mon-task-hostname", fl.TaskHostname,
		"name of the host on which this task is running")
	f.IntVar(&fl.TaskNumber, "ts-mon-task-number", fl.TaskNumber,
		"number (e.g. for replication) of this instance of this task")
	f.BoolVar(&fl.AutoGenHostname, "ts-mon-autogen-hostname", fl.AutoGenHostname,
		"Indicate that the hostname is autogenerated. "+
			"This option must be set on autoscaled GCE VMs, Kubernetes pods, "+
			"or any other hosts with dynamically generated names.")
}
1274087
func (daemon *Daemon) Register(c *container.Container) error {
	// Attach to stdout and stderr
	if c.Config.OpenStdin {
		c.StreamConfig.NewInputPipes()
	} else {
		c.StreamConfig.NewNopInputPipe()
	}

	// once in the memory store it is visible to other goroutines
	// grab a Lock until it has been checkpointed to avoid races
	c.Lock()
	defer c.Unlock()

	daemon.containers.Add(c.ID, c)
	daemon.idIndex.Add(c.ID)
	return c.CheckpointTo(daemon.containersReplica)
}
1341899
func (b *Bot) Register(cmd CommandInterface) {
	b.Commands = append(b.Commands, cmd)
}
149573
func (c *Commands) Register(cmdstr string, cf cmdfunc, helpMsg string) {
	for _, v := range c.cmds {
		if v.match(cmdstr) {
			v.cmdFn = cf
			return
		}
	}

	c.cmds = append(c.cmds, command{aliases: []string{cmdstr}, cmdFn: cf, helpMsg: helpMsg})
}
893652
func (cmd *Command) RegisterFunc(name string, fn CommandFunc, argvFn ArgvFunc) *Command {
	return cmd.Register(&Command{Name: name, Fn: fn, Argv: argvFn})
}
489442
func Register(local *pflag.FlagSet, globalName string) {
	if f := flag.CommandLine.Lookup(globalName); f != nil {
		pflagFlag := pflag.PFlagFromGoFlag(f)
		pflagFlag.Name = normalize(pflagFlag.Name)
		local.AddFlag(pflagFlag)
	} else {
		panic(fmt.Sprintf("failed to find flag in global flagset (flag): %s", globalName))
	}
}
1167504
func Register(trigger string, args ...interface{}) {
	tl.Lock()
	defer tl.Unlock()

	var f interface{}
	var priority int

	if len(args) >= 2 {
		priority, _ = args[0].(int)
		f = args[1]
	} else {
		priority = 0
		f = args[0]
	}

	str := args[len(args)-1]

	// if the last element you pass in is a string, and not a function, then lets default to exec
	if _, isString := str.(string); isString {
		f = func(i interface{}) {
			payload, err := json.Marshal(i)
			if err != nil {
				return
			}

			in := bytes.NewReader(payload)
			cmd := exec.Command("bash", "-c", str.(string))
			cmd.Stdin = in

			if results, err := cmd.Output(); err == nil {
				json.Unmarshal(results, &i)
			}
		}
	}

	_, exists := triggers[trigger]
	if !exists {
		triggers[trigger] = make(map[int][]interface{})
		for p := 0; p <= 100; p++ {
			triggers[trigger][p] = make([]interface{}, 0)
		}
	}
	triggers[trigger][priority] = append(triggers[trigger][priority], f)
}