Documentation
¶
Overview ¶
Package utils ...
Package utils ...
Package utils ...
Package utils ...
Package utils ...
Index ¶
- func CurrentYear() string
- func ExitIfError(err error)
- func GetInstalledNPMClientList() []npmc.NPMClient
- func GetNPMClientInfo(name string) (bool, string)
- func GetNPMClientNames(items []npmc.NPMClient) []string
- func GetSelectedNPMClient(in []npmc.NPMClient, name string) npmc.NPMClient
- func IsError(err error, showMessage bool) bool
- func IsValidURL(input string) bool
- func PlusOne(x int) int
- func RetrievePackageManagerFromPkgJSON(appFS afero.Fs, pathToPkgJSON string) (npmc.NPMClient, error)
- func RetrieveProjectName(appFS afero.Fs, pathToPkgJSON string) (string, error)
- func Sum(x int, y int) int
- func ToBasePath(fullpath string, replace string) string
- func ToLibFile(txt string) string
- func ToMDFile(txt string, uppercase bool) string
- func ToSlug(txt string) string
- func ToSnakeCase(txt string) string
- func ToTitle(txt string) string
- func ToURL(txt string) string
- func ToVariableName(txt string) string
- func Today() string
- func Trimmed(txt string) string
- func Underline(txt string) string
- type GitHubRepo
- type ProgressBar
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentYear ¶
func CurrentYear() string
CurrentYear returns the current calendar year as a string.
func ExitIfError ¶ added in v0.5.0
func ExitIfError(err error)
ExitIfError panics on os.Exit(1) if error.
func GetInstalledNPMClientList ¶ added in v0.3.0
GetInstalledNPMClientList returns the list of installed npmClient as slice of NPMClient.
func GetNPMClientInfo ¶ added in v0.3.0
GetNPMClientInfo returns true and npm client version as string.
func GetNPMClientNames ¶ added in v0.3.0
GetNPMClientNames returns the list of installed npmClient as slice of strings.
func GetSelectedNPMClient ¶ added in v0.3.0
GetSelectedNPMClient returns the selected NPMClient struct out of the available ones.
func IsError ¶ added in v0.5.0
IsError returns true if error is not nil. If showMessage is true it prints out a warning with the error message.
func IsValidURL ¶ added in v0.8.0
IsValidURL returns true if the input string is a well-structured url
func RetrievePackageManagerFromPkgJSON ¶ added in v0.7.0
func RetrievePackageManagerFromPkgJSON(appFS afero.Fs, pathToPkgJSON string) (npmc.NPMClient, error)
RetrievePackageManagerFromPkgJSON returns NPMClient struct parsing the package.json file.
func RetrieveProjectName ¶ added in v0.5.0
RetrieveProjectName returns the project name as string parsing the package.json file.
func ToBasePath ¶ added in v0.4.0
ToBasePath returns a copy of string replacing all occurrences for a string with trailing slash.
func ToLibFile ¶ added in v0.5.4
ToLibFile returns a string a valid lib filename example: ToLibFile("category") returns 'apiCategory.ts'.
func ToMDFile ¶
ToMDFile returns a string with .md extension example: ToMDFile("getting started", false) returns 'getting-started.md'. example: ToMDFile("getting started", true) returns 'GETTING-STARTED.md'.
func ToSlug ¶ added in v0.5.4
ToSlug returns a copy of string with lowercase replacing "_" and whitespaces with "-" example: ToSlug("New Resource") returns new-resource.
func ToSnakeCase ¶ added in v0.8.3
ToSnakeCase returns a copy of string with lowercase replacing "_" and whitespaces with "_" example: ToSnakeCase("New Resource") returns new_resource.
func ToTitle ¶
ToTitle replace all '-' char with a white space and returns a copy of string s with all letters of string whose begin words mapped to their title case.
func ToVariableName ¶ added in v0.5.4
ToVariableName returns a copy of string to be used as variable name.
Types ¶
type GitHubRepo ¶ added in v0.8.0
type GitHubRepo struct {
// contains filtered or unexported fields
}
GitHubRepo is the struct representing a GitHub repository
func NewGitHubURLParser ¶ added in v0.8.0
func NewGitHubURLParser(input string) (*GitHubRepo, error)
NewGitHubURLParser takes a github url and returns the repository info as GitHubRepo struct
func (*GitHubRepo) GetHost ¶ added in v0.8.0
func (gh *GitHubRepo) GetHost() string
GetHost returns the host as string
func (*GitHubRepo) GetRepo ¶ added in v0.8.0
func (gh *GitHubRepo) GetRepo() string
GetRepo returns the repo name as string
func (*GitHubRepo) GetUser ¶ added in v0.8.0
func (gh *GitHubRepo) GetUser() string
GetUser returns the repo's owner as string
type ProgressBar ¶ added in v0.4.0
type ProgressBar struct {
// contains filtered or unexported fields
}
ProgressBar is the struct representing a progressbar instance.
func NewProgressBar ¶ added in v0.4.0
func NewProgressBar(total int) *ProgressBar
NewProgressBar returns a pointer to a ProgressBar struct.
func (*ProgressBar) Increment ¶ added in v0.4.0
func (pb *ProgressBar) Increment()
Increment increments progress by amount of n.
func (*ProgressBar) Wait ¶ added in v0.4.0
func (pb *ProgressBar) Wait()
Wait blocks until bar is completed or aborted.