Documentation
¶
Index ¶
Constants ¶
View Source
const ( API = "api" ClientId = "client_id" ClientSecret = "client_secret" )
Variables ¶
View Source
var ApiHostToUrlMap = map[string]string{
"api.moltin.com": "https://euwest.cm.elasticpath.com/",
"useast.api.elasticpath.com": "https://useast.cm.elasticpath.com/",
}
View Source
var Logs = &cobra.Command{Use: "logs"}
View Source
var LogsClear = &cobra.Command{ Use: "clear", Short: "Clears all HTTP request and response logs", RunE: func(cmd *cobra.Command, args []string) error { os.RemoveAll(shared.LogDirectory) return nil }, }
View Source
var LogsList = &cobra.Command{ Use: "list", Short: "List all HTTP logs", RunE: func(cmd *cobra.Command, args []string) error { files := shared.AllFilesSortedByDate(shared.LogDirectory) for i := 0; i < len(files); i++ { name, _ := shared.Base64DecodeStripped(files[i].Name()) fmt.Println(name) } return nil }, }
View Source
var LogsShow = &cobra.Command{ Use: "show <NUMBER>", Short: "Show HTTP logs for specific number", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { files := shared.AllFilesSortedByDate(shared.LogDirectory) for i := 0; i < len(files); i++ { name, _ := shared.Base64DecodeStripped(files[i].Name()) segments := strings.Split(name, " ") if segments[0] == args[0] { content, err := os.ReadFile(shared.LogDirectory + "/" + files[i].Name()) if err != nil { return err } fmt.Print(string(content)) break } } return nil }, }
View Source
var RootCmd = &cobra.Command{ Use: os.Args[0], Short: "A command line interface for interacting with the Elastic Path Commerce Cloud API", Long: `The EPCC CLI tool provides a powerful command line interface for interacting with the Elastic Path Commerce Cloud API. The EPCC CLI tool uses environment variables for configuration and in particular a tool like https://direnv.net/ which auto populates your shell with environment variables when you switch directories. This allows you to store a context in a folder, and come back to it at any time. Environment Variables - EPCC_API_BASE_URL - The API endpoint that we will hit - EPCC_CLIENT_ID - The client id (available in Commerce Manager) - EPCC_CLIENT_SECRET - The client secret (available in Commerce Manager) - EPCC_BETA_API_FEATURES - Beta features in the API we want to enable. `, PersistentPreRun: func(cmd *cobra.Command, _ []string) { log.SetLevel(logger.Loglevel) }, SilenceUsage: true, Version: fmt.Sprintf("EPCC CLI %s (Commit %s)", version.Version, version.Commit), }
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.