Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Auth = cli.Command{
Name: "auth",
Usage: "Manage Common Fate authentication",
Subcommands: []*cli.Command{
&tokenCommand,
&refreshCommand,
&setCommand,
},
}
View Source
var Configure = cli.Command{ Name: "configure", Usage: "Configure CLI", ArgsUsage: "The frontend url for your deployment", Flags: []cli.Flag{&cli.StringFlag{Name: "context-name", Value: "default"}}, Action: func(c *cli.Context) error { u := c.Args().First() if u == "" { return errors.New("please provide a url argument") } url, err := url.Parse(u) if err != nil { return err } url = url.JoinPath("/config.json") err = ConfigureFromURL(url.String(), WithContextName(c.String("context-name"))) if err != nil { return err } clio.Success("Successfully updated config") return nil }, }
View Source
var Context = cli.Command{ Name: "context", Usage: "Manage your current CLI context", Subcommands: []*cli.Command{ { Name: "switch", Action: func(c *cli.Context) error { contexts, err := config.ListContexts() if err != nil { return err } var context string err = survey.AskOne(&survey.Select{ Options: contexts, Message: "select a context", }, &context) if err != nil { return err } err = config.SwitchContext(context) if err != nil { return err } clio.Successf("Successfully switch context to %s", context) return nil }, }, }, }
View Source
var Login = cli.Command{ Name: "login", Usage: "Log in to Common Fate", Action: func(c *cli.Context) error { cfg, err := config.LoadDefault(c.Context) if err != nil { return err } lf := loginflow.NewFromConfig(cfg) return lf.Login(c.Context) }, }
View Source
var Logout = cli.Command{ Name: "logout", Usage: "Log out of Common Fate", Action: func(c *cli.Context) error { cfg, err := config.LoadDefault(c.Context) if err != nil { return err } return cfg.TokenStore.Clear() }, }
Functions ¶
func ConfigureFromURL ¶
func ConfigureFromURL(u string, opts ...func(o *ConfigureFromURLOpts)) error
func WithContextName ¶
func WithContextName(name string) func(o *ConfigureFromURLOpts)
Types ¶
type Config ¶
type Config struct { OauthClientId string `json:"oauthClientId"` CliOAuthClientId string `json:"cliOAuthClientId"` OauthAuthority string `json:"oauthAuthority"` APIURL string `json:"apiUrl"` AccessAPIURL string `json:"accessApiUrl"` AuthzGraphAPIURL string `json:"authzGraphApiUrl"` TeamName string `json:"teamName"` FaviconUrl string `json:"faviconUrl"` IconUrl string `json:"iconUrl"` }
type ConfigureFromURLOpts ¶
type ConfigureFromURLOpts struct {
ContextName string
}
Click to show internal directories.
Click to hide internal directories.