Esempio n. 1
0
// Parse parses the common flags.
func (c *commonFlags) Parse(a subcommands.Application) error {
	if err := c.defaultFlags.Parse(); err != nil {
		return err
	}
	if c.serverURL == "" {
		return errors.New("must provide -server")
	}
	s, err := lhttp.CheckURL(c.serverURL)
	if err != nil {
		return err
	}
	c.serverURL = s
	return nil
}
Esempio n. 2
0
func (c *Flags) Parse() error {
	if c.ServerURL == "" {
		return errors.New("-isolate-server must be specified")
	}
	if c.ServerURL == "fake" {
		ts := httptest.NewServer(isolatedfake.New())
		c.ServerURL = ts.URL
	} else {
		if s, err := lhttp.CheckURL(c.ServerURL); err != nil {
			return err
		} else {
			c.ServerURL = s
		}
	}
	if c.Namespace == "" {
		return errors.New("-namespace must be specified")
	}
	return nil
}