Documentation ¶
Index ¶
- Constants
- Variables
- func CloneSampleCloudCode(e *Env, dumpTemplate bool) error
- func CreateConfigWithContent(path, content string) error
- func ErrorString(e *Env, err error) string
- func GetConfigFile(e *Env) string
- func GetLegacyProjectRoot(e *Env, cur string) string
- func GetProjectRoot(e *Env, cur string) string
- func IsProjectDir(cur string) bool
- func Last4(str string) string
- func MakeCorrections(commands []string, args []string) string
- func NewAppHarness(t testing.TB) (*Harness, []*App)
- func PrintDefault(e *Env, defaultApp string) error
- func RunNoArgs(e *Env, f func(*Env) error) cobraRun
- func RunWithArgs(e *Env, f func(*Env, []string) error) cobraRun
- func RunWithArgsClient(e *Env, f func(*Env, *Context, []string) error) cobraRun
- func RunWithClient(e *Env, f func(*Env, *Context) error) cobraRun
- func RunWithClientConfirm(e *Env, f func(*Env, *Context) error) cobraRun
- func SetDefault(e *Env, newDefault, defaultApp string, c Config) error
- func SetParserEmail(e *Env, email string) error
- func StoreConfig(e *Env, c Config) error
- func StoreProjectConfig(e *Env, c Config) error
- func SuggestCommands(given string, available []string) []string
- type App
- type AppConfig
- type Apps
- func (a *Apps) CreateApp(e *Env, givenName string, retries int) (*App, error)
- func (a *Apps) PrintApp(e *Env, params *App) error
- func (a *Apps) RestFetchApps(e *Env) ([]*App, error)
- func (a *Apps) SelectApp(apps []*App, msg string, e *Env) (*App, error)
- func (a *Apps) ShowApps(e *Env, appName string) error
- type Config
- type Context
- type Credentials
- type Env
- type Harness
- type Login
- func (l *Login) AuthToken(e *Env, token string) (string, error)
- func (l *Login) AuthUser(e *Env, strict bool) error
- func (l *Login) AuthUserWithToken(e *Env, strict bool) (string, error)
- func (l *Login) GetTokenCredentials(e *Env, email string) (bool, *Credentials, error)
- func (l *Login) HelpCreateToken(e *Env) (string, error)
- func (l *Login) StoreCredentials(e *Env, email string, credentials *Credentials) error
- type ParseAPIClient
- func (c *ParseAPIClient) Delete(u *url.URL, result interface{}) (*http.Response, error)
- func (c *ParseAPIClient) Do(req *http.Request, body, result interface{}) (*http.Response, error)
- func (c *ParseAPIClient) Get(u *url.URL, result interface{}) (*http.Response, error)
- func (c *ParseAPIClient) Post(u *url.URL, body, result interface{}) (*http.Response, error)
- func (c *ParseAPIClient) Put(u *url.URL, body, result interface{}) (*http.Response, error)
- func (c *ParseAPIClient) RoundTrip(req *http.Request) (*http.Response, error)
- func (c *ParseAPIClient) WithCredentials(cr parse.Credentials) *ParseAPIClient
- type ParseAppConfig
- func (c *ParseAppConfig) GetApplicationAuth(e *Env) (string, error)
- func (c *ParseAppConfig) GetApplicationID() string
- func (c *ParseAppConfig) GetLink() string
- func (c *ParseAppConfig) GetMasterKey(e *Env) (string, error)
- func (c *ParseAppConfig) WithInternalMasterKey(masterKey string) *ParseAppConfig
- type ParseConfig
- func (c *ParseConfig) AddAlias(name, link string) error
- func (c *ParseConfig) App(name string) (AppConfig, error)
- func (c *ParseConfig) GetDefaultApp() string
- func (c *ParseConfig) GetNumApps() int
- func (c *ParseConfig) GetProjectConfig() *ProjectConfig
- func (c *ParseConfig) PrettyPrintApps(e *Env)
- func (c *ParseConfig) SetDefaultApp(name string) error
- type ParseProjectConfig
- type ProjectConfig
- type TransportFunc
Constants ¶
const ( LegacyParseFormat = iota ParseFormat ParseLocal = ".parse.local" ParseProject = ".parse.project" DefaultKey = "_default" )
const ( Version = "3.3.1" CloudDir = "cloud" HostingDir = "public" DefaultBaseURL = "https://parsecli.back4app.com/" )
const ( SampleSource = `` /* 161-byte string literal not displayed */ SampleHTML = `` /* 779-byte string literal not displayed */ )
const ConfigDir = "config"
Variables ¶
var LegacyConfigFile = filepath.Join(ConfigDir, "global.json")
var NewProjectFiles = []struct { Dirname, Filename, Content string }{ {"cloud", "main.js", SampleSource}, {"public", "index.html", SampleHTML}, }
Functions ¶
func CloneSampleCloudCode ¶
func CreateConfigWithContent ¶
func ErrorString ¶
errorString returns the error string with our without the stack trace depending on the Environment variable. this exists because we want plain messages for end users, but when we're working on the CLI we want the stack trace for debugging.
func GetConfigFile ¶
func GetLegacyProjectRoot ¶
func GetProjectRoot ¶
func IsProjectDir ¶
func MakeCorrections ¶
MakeCorrections can be used to automatically correct the incorrect command in input args and return either an action that was taken or a suggestions message. One can also provide a map of aliases and related conversions
func PrintDefault ¶
func RunWithArgs ¶
RunWithArgs wraps a run function that can access arguments to cobraCmd
func RunWithArgsClient ¶
RunWithArgsClient wraps a run function that should get an app, whee the default is picked from the config in the current working directory. It also passes args to the runner function
func RunWithClient ¶
RunWithClient wraps a run function that should get an app, when the default is picked from the config in the current working directory.
func RunWithClientConfirm ¶
RunWithClientConfirm wraps a run function that takes an app name or asks for confirmation to use the default app name instead
func SetParserEmail ¶
func StoreConfig ¶
func StoreProjectConfig ¶
func SuggestCommands ¶
SuggestCommands can be used to match a given word which is very similar to one among the list of available commands.
Types ¶
type App ¶
type App struct { Name string `json:"appName"` DashboardURL string `json:"dashboardURL"` ApplicationID string `json:"applicationId"` ClientKey string `json:"clientKey"` JavaScriptKey string `json:"javascriptKey"` WindowsKey string `json:"windowsKey"` WebhookKey string `json:"webhookKey"` RestKey string `json:"restKey"` MasterKey string `json:"masterKey"` ClientPushEnabled bool `json:"clientPushEnabled"` ClientClassCreationEnabled bool `json:"clientClassCreationEnabled"` RequireRevocableSessions bool `json:"requireRevocableSessions"` RevokeSessionOnPasswordChange bool `json:"revokeSessionOnPasswordChange"` }
type Config ¶
type Config interface { App(string) (AppConfig, error) AddAlias(string, string) error SetDefaultApp(string) error GetProjectConfig() *ProjectConfig GetDefaultApp() string GetNumApps() int PrettyPrintApps(*Env) }
func ConfigFromDir ¶
type Credentials ¶
type Harness ¶
type Harness struct { T testing.TB Out bytes.Buffer Err bytes.Buffer Clock *clock.Mock Env *Env // contains filtered or unexported fields }
func NewHarness ¶
func NewTokenHarness ¶
func (*Harness) MakeEmptyRoot ¶
func (h *Harness) MakeEmptyRoot()
func (*Harness) MakeWithConfig ¶
type Login ¶
type Login struct { Credentials Credentials TokenReader io.Reader }
func (*Login) AuthUserWithToken ¶
func (*Login) GetTokenCredentials ¶
func (*Login) StoreCredentials ¶
func (l *Login) StoreCredentials(e *Env, email string, credentials *Credentials) error
type ParseAPIClient ¶
ParseAPIClient is the http client used by parse-cli
func NewParseAPIClient ¶
func NewParseAPIClient(e *Env) (*ParseAPIClient, error)
func (*ParseAPIClient) Delete ¶
Delete performs a DELETE method call on the given url and unmarshal response into result.
func (*ParseAPIClient) Get ¶
Get performs a GET method call on the given url and unmarshal response into result.
func (*ParseAPIClient) Post ¶
Post performs a POST method call on the given url with the given body and unmarshal response into result.
func (*ParseAPIClient) Put ¶
Put performs a PUT method call on the given url with the given body and unmarshal response into result.
func (*ParseAPIClient) WithCredentials ¶
func (c *ParseAPIClient) WithCredentials(cr parse.Credentials) *ParseAPIClient
WithCredentials is a wrapper for parse.Client.WithCredentials
type ParseAppConfig ¶
type ParseAppConfig struct { ApplicationID string `json:"applicationId,omitempty"` MasterKey string `json:"masterKey,omitempty"` Link string `json:"link,omitempty"` // contains filtered or unexported fields }
func (*ParseAppConfig) GetApplicationAuth ¶
func (c *ParseAppConfig) GetApplicationAuth(e *Env) (string, error)
func (*ParseAppConfig) GetApplicationID ¶
func (c *ParseAppConfig) GetApplicationID() string
func (*ParseAppConfig) GetLink ¶
func (c *ParseAppConfig) GetLink() string
func (*ParseAppConfig) GetMasterKey ¶
func (c *ParseAppConfig) GetMasterKey(e *Env) (string, error)
func (*ParseAppConfig) WithInternalMasterKey ¶
func (c *ParseAppConfig) WithInternalMasterKey(masterKey string) *ParseAppConfig
type ParseConfig ¶
type ParseConfig struct { Applications map[string]*ParseAppConfig `json:"applications,omitempty"` ProjectConfig *ProjectConfig `json:"-"` }
func (*ParseConfig) AddAlias ¶
func (c *ParseConfig) AddAlias(name, link string) error
func (*ParseConfig) GetDefaultApp ¶
func (c *ParseConfig) GetDefaultApp() string
func (*ParseConfig) GetNumApps ¶
func (c *ParseConfig) GetNumApps() int
func (*ParseConfig) GetProjectConfig ¶
func (c *ParseConfig) GetProjectConfig() *ProjectConfig
func (*ParseConfig) PrettyPrintApps ¶
func (c *ParseConfig) PrettyPrintApps(e *Env)
func (*ParseConfig) SetDefaultApp ¶
func (c *ParseConfig) SetDefaultApp(name string) error
type ParseProjectConfig ¶
type ParseProjectConfig struct {
JSSDK string `json:"jssdk,omitempty"`
}
type ProjectConfig ¶
type ProjectConfig struct { // Type indicates the type of config. // Some examples are legacy, parse, etc. Type int `json:"project_type,omitempty"` // Parse stores the project config for Parse type. // Currently jssdk version is the only // project level config for Parse type. Parse *ParseProjectConfig `json:"parse,omitempty"` // ParserEmail is an email id of the Parse developer. // It is associated with this project. // It is used to fetch appropriate credentials from netrc. ParserEmail string `json:"email,omitempty"` }