Documentation
¶
Index ¶
- Variables
- func BrowserFlow(opts BrowserFlowOptions) error
- func CheckLatestRelease(ctx context.Context, logger logger.Logger, force bool) (bool, error)
- func CopyDir(src string, dst string) error
- func CopyFile(src, dst string) (int64, error)
- func EnsureLoggedIn(ctx context.Context, logger logger.Logger, cmd *cobra.Command) (string, string)
- func EnsureLoggedInWithOnlyAPIKey(ctx context.Context, logger logger.Logger, cmd *cobra.Command) string
- func Exists(fn string) bool
- func GetAppSupportDir(appName string) string
- func GetLatestRelease(ctx context.Context) (string, error)
- func GetRelativePath(basePath, absolutePath string) string
- func GetURLs(logger logger.Logger) (string, string, string)
- func ListDir(dir string) ([]string, error)
- func MaxString(val string, max int) string
- func NewOrderedMap(keys []string, data map[string]any) *orderedMap
- func NewOrderedMapFromFile(keys []string, filename string) (*orderedMap, error)
- func NewOrderedMapFromJSON(keys []string, buf []byte) (*orderedMap, error)
- func Pluralize(count int, singular string, plural string) string
- func ProcessKill(cmd *exec.Cmd)
- func ProcessSetup(cmd *exec.Cmd)
- func PromptBrowserOpen(logger interface{ ... }, url string)
- func RandStringBytes(n int) string
- func ReadFileLines(filename string, startLine, endLine int) ([]string, error)
- func RemoveDuplicates[T comparable](slice []T) []T
- func RemoveEmpty[T comparable](slice []T) []T
- func SafeProjectFilename(name string, python bool) string
- func ShowLogin(ctx context.Context, logger logger.Logger, cmd *cobra.Command)
- func TransformUrl(urlString string) string
- func TryLoggedIn() (string, string, bool)
- func UpgradeCLI(ctx context.Context, logger logger.Logger, force bool) error
- func UserAgent() string
- func ZipDir(dir string, outfilename string, opts ...Option) error
- type APIClient
- type APIError
- type APIResponse
- type BrowserFlowOptions
- type Option
- type ZipDirCallbackMatcher
- type ZipDirCallbackMutator
Constants ¶
This section is empty.
Variables ¶
var ( Version = "dev" Commit = "unknown" )
var ErrTimeout = errors.New("timeout")
var PackageJsonKeysOrder = []string{
"name",
"description",
"version",
"main",
"type",
"scripts",
"keywords",
"author",
"license",
"engines",
"private",
"devDependencies",
"peerDependencies",
"dependencies",
}
these are the keys that will be written in order to the package.json file if a key is not present, it will be added to the end of the file
var TypeScriptConfigJsonKeysOrder = []string{
"compilerOptions",
"include",
"exclude",
}
these are the keys that will be written in order to the package.json file if a key is not present, it will be added to the end of the file
Functions ¶
func BrowserFlow ¶
func BrowserFlow(opts BrowserFlowOptions) error
BrowserFlow will open a browser and wait for the user to finish the flow. It will return an error if the flow times out with an ErrTimeout error. It will return an error if the callback fails or any other error occurs.
func CheckLatestRelease ¶ added in v0.0.70
func EnsureLoggedIn ¶ added in v0.0.42
func EnsureLoggedInWithOnlyAPIKey ¶ added in v0.0.43
func GetAppSupportDir ¶ added in v0.0.74
GetAppSupportDir returns the path to the application support directory for the current user. It supports Darwin, Windows, and Linux. Returns an empty string if the directory cannot be determined.
func GetLatestRelease ¶ added in v0.0.70
GetLatestRelease returns the latest release tag name from the GitHub API
func GetRelativePath ¶ added in v0.0.75
func NewOrderedMap ¶ added in v0.0.26
func NewOrderedMapFromFile ¶ added in v0.0.26
func NewOrderedMapFromJSON ¶ added in v0.0.26
func ProcessKill ¶ added in v0.0.74
func ProcessSetup ¶ added in v0.0.74
func PromptBrowserOpen ¶ added in v0.0.162
PromptBrowserOpen prompts the user to press Enter to open a browser to the given URL. It handles display detection on Linux and provides appropriate user feedback.
func RandStringBytes ¶
RandStringBytes will generate a random string of length n using the alphaNumChars string.
func ReadFileLines ¶ added in v0.0.75
func RemoveDuplicates ¶ added in v0.0.121
func RemoveDuplicates[T comparable](slice []T) []T
func RemoveEmpty ¶ added in v0.0.121
func RemoveEmpty[T comparable](slice []T) []T
func SafeProjectFilename ¶ added in v0.0.142
func TransformUrl ¶ added in v0.0.47
func TryLoggedIn ¶ added in v0.0.74
func UpgradeCLI ¶ added in v0.0.75
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
func NewAPIClient ¶
type APIError ¶ added in v0.0.51
type APIError struct {
URL string
Method string
Status int
Body string
TheError error
TraceID string
}
func NewAPIError ¶ added in v0.0.51
type APIResponse ¶ added in v0.0.52
type BrowserFlowOptions ¶
type Option ¶ added in v0.0.143
type Option func(*options)
func WithMatcher ¶ added in v0.0.143
func WithMatcher(matcher ZipDirCallbackMatcher) Option
WithMatcher will filter the files that are added to the zip
func WithMutator ¶ added in v0.0.143
func WithMutator(mutator ZipDirCallbackMutator) Option
WithMutator will mutate the zip file after it has been created allowing you to add files to the zip
type ZipDirCallbackMatcher ¶
ZipDirCallbackMatcher is a function that returns true if the file should be included in the zip