Documentation ¶
Overview ¶
Package utils ...
Package utils ...
Package utils ...
Package utils ...
Package utils ...
Index ¶
- func CheckIfError(err error)
- func CurrentYear() string
- 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 PlusOne(x int) int
- func RetrievePackageManagerFromPkgJson(appFS afero.Fs, pathToPkgJson string) (npmc.NPMClient, error)
- func Sum(x int, y int) int
- func ToBasePath(fullpath string, replace string) string
- func ToLibFilename(txt string) string
- func ToMDFile(text string) string
- func ToPageVariableName(txt string) string
- func ToTitle(txt string) string
- func ToURL(txt string) string
- func ToValidName(txt string) string
- func Today() string
- func Trimmed(txt string) string
- type ListWriter
- type Logger
- type Printer
- type PrinterBuffer
- type ProgressBar
- type TextLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckIfError ¶ added in v0.2.0
func CheckIfError(err error)
CheckIfError panics on os.Exit(1) if error
func CurrentYear ¶
func CurrentYear() string
CurrentYear returns the current calendar year as a string.
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 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 ToBasePath ¶ added in v0.4.0
ToBasePath returns a copy of string replacing all occurrences for a string with trailing slash.
func ToLibFilename ¶
ToLibFilename 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 ToPageVariableName ¶ added in v0.2.8
ToPageVariableName returns a human readable string replacing '-' with white space and capitalizing first letters of each word.
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 ToValidName ¶ added in v0.2.8
ToValidName returns a copy of string replacing '_' with '-' example: ToValidName("getting_started") returns 'getting-started'.
Types ¶
type ListWriter ¶ added in v0.3.0
type ListWriter struct {
// contains filtered or unexported fields
}
ListWriter is the struct wrapping the list.Writer.
func NewListWriter ¶ added in v0.3.0
func NewListWriter() ListWriter
NewListWriter creates a new ListWriter.
func (ListWriter) AppendItem ¶ added in v0.3.0
func (lw ListWriter) AppendItem(message string)
AppendItem addend an item to the ListWriter.
func (ListWriter) Indent ¶ added in v0.3.0
func (lw ListWriter) Indent()
Indent applies indent the output.
func (ListWriter) Render ¶ added in v0.3.0
func (lw ListWriter) Render() string
Render printout the ListWriter to the stadout.
func (ListWriter) SetBulletTriangleStyle ¶ added in v0.3.0
func (lw ListWriter) SetBulletTriangleStyle()
SetBulletTriangleStyle sets BulletTriangle as style to the ListWriter.
func (ListWriter) SetStyle ¶ added in v0.3.0
func (lw ListWriter) SetStyle(style list.Style)
SetStyle sets the list style to be applied on the ListWriter.
func (ListWriter) UnIndent ¶ added in v0.3.0
func (lw ListWriter) UnIndent()
UnIndent applies unindent to the outout.
type Logger ¶ added in v0.3.0
type Logger interface { SetTitle(text string) GetTitle() string SetContent(text string) GetContent() string Reset() }
Logger interface declares the methods to set the loggers props.
type Printer ¶ added in v0.3.0
type Printer interface {
Print()
}
Printer interface declares just the single method for printing the buffer content.
type PrinterBuffer ¶
type PrinterBuffer struct {
// contains filtered or unexported fields
}
PrinterBuffer is the struct representing the buffer.
func PrettyPrinter ¶
func PrettyPrinter(tl *TextLogger) PrinterBuffer
PrettyPrinter returns a PrinterBuffer as formatted content ready to be printout to stdout.
func (PrinterBuffer) Print ¶
func (pb PrinterBuffer) Print()
Print prints out the buffer content to the stdout.
func (PrinterBuffer) ToString ¶
func (pb PrinterBuffer) ToString() string
ToString returns the buffer content 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.
type TextLogger ¶ added in v0.3.0
type TextLogger struct {
// contains filtered or unexported fields
}
TextLogger is the struct used to write on the stdout as plain text.
func NewTextLogger ¶ added in v0.3.0
func NewTextLogger() *TextLogger
NewTextLogger returns a pointer to a TextLogger.
func (*TextLogger) GetContent ¶ added in v0.3.0
func (tl *TextLogger) GetContent() string
GetContent returns the TextLogger content as string.
func (*TextLogger) GetTitle ¶ added in v0.3.0
func (tl *TextLogger) GetTitle() string
GetTitle returns the TextLogger title as string.
func (*TextLogger) SetContent ¶ added in v0.3.0
func (tl *TextLogger) SetContent(content string)
SetContent sets the content for the TextLogger.
func (*TextLogger) SetTitle ¶ added in v0.3.0
func (tl *TextLogger) SetTitle(title string)
SetTitle sets the title for the TextLogger.