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 GitClone(sveltinTemplate *config.AppTemplate, inpath string) error
- func IsError(err error, showMessage bool) 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) string
- func ToSlug(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
- 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 GitClone ¶
func GitClone(sveltinTemplate *config.AppTemplate, inpath string) error
GitClone clones the git repo to the specified path.
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 RetrievePackageManagerFromPkgJson ¶ added in v0.3.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: ToLibFilename("category") returns 'getCategory.js'.
func ToMDFile ¶
ToMDFile returns a string with .md suffix example: ToMDFile("welcome") returns 'welcome.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 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 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.