Documentation
¶
Index ¶
- func AddContentInsideFunction(filePath, functionName, newContent string) error
- func AddEnvConfigFromString(newConfig, workDirectory string) error
- func AddGoConfigFromString(newConfig, workDirectory string) error
- func AskConfirm(question string) (bool, error)
- func AskData(question string) (string, error)
- func AskDataWithValidation(questionTitle string, validator survey.Validator) (string, error)
- func CheckAllGoFilesInDirectory(dirPath string) error
- func CheckPackageNameInFile(filePath string, expectedPackageName string) (bool, error)
- func CheckSyntaxGoFile(filePath string) (bool, error)
- func CheckZipIntegrity(zipPath string) error
- func CopyFileOrDirectory(sourcePath string, destPath string) error
- func CreateFileFromTemplate(templatePath, finalPath string) error
- func CreateFileFromTemplateWithCustomReplace(templatePath, finalPath string, replaces map[string]string) error
- func DownloadFile(url string, destPath string) error
- func ExtendFile(filePath, newContent string) error
- func ExtractImports(code string) []string
- func ExtractPackageLine(code string) string
- func FileOrDirectoryExists(filePath string) bool
- func FunctionExistsInFile(filePath string, functionName string) (bool, error)
- func GetDependenciesInstallationOrder(dependencyFilePath string) ([]string, error)
- func GetExecutablePath() (string, error)
- func GetMD5Hash(data string) string
- func GetThisModuleName() (string, error)
- func ImportBaseContent(sourcePath, finalPath string) error
- func InitGoModules(ApplicationName, basePath string) error
- func InstallNeededPackages(basePath string) error
- func IsGithubUrl(url string) bool
- func IsUrl(url string) bool
- func ListDirectories(dirPath string) ([]string, error)
- func ListDirectoriesAndFiles(dirPath string) ([]string, error)
- func ListFiles(dirPath string) ([]string, error)
- func MakeTemporalDirectory() (string, error)
- func MoveFileOrDirectory(sourcePath string, destPath string) error
- func ParsePromptFile(promptFilePath string, placeholdersToReplace *map[string]string, ...) error
- func ReadFile(filePath string) (string, error)
- func ReadFileWithCustomReplace(filePath string, replaces map[string]string) (string, error)
- func RemovePackageAndImports(code string) string
- func SanitizeFileName(input string) string
- func SliceContainsElement(slice []string, target string) bool
- func TempFileWithDummyPlaceholder(filePath string) (string, error)
- func Unzip(src, dest string) error
- func ValidateAllDependenciesInstalled(dependsFilePath string) (bool, []string, error)
- func ValidateTemplateName(templateName string) error
- func ZipDirectoryContent(outputzipfilepath, directoryPath string) error
- type MksTemplatePath
- type Prompt
- type PromptsFileFormat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddContentInsideFunction ¶
Function to add a new configuration before the closing of the Config structure in the source file
func AddEnvConfigFromString ¶
Function to add a new configuration before the closing of the Config structure in the source file
func AddGoConfigFromString ¶
Function to add a new configuration before the closing of the Config structure in the source file
func AskConfirm ¶
func AskDataWithValidation ¶
func CheckPackageNameInFile ¶
this function checks if a certain package name exists in a file (golang file)
func CheckSyntaxGoFile ¶
this function checks if is a valid go file
func CheckZipIntegrity ¶
func CopyFileOrDirectory ¶
Copy file or directory (with contents) to new location
func CreateFileFromTemplate ¶
Create files from templates wich only needs to changes %%PACKAGE_NAME%%
func CreateFileFromTemplateWithCustomReplace ¶
func CreateFileFromTemplateWithCustomReplace(templatePath, finalPath string, replaces map[string]string) error
Create files from templates that has many placeholders to replace
func DownloadFile ¶
Download file from url to destination
func ExtendFile ¶
Function to extend file content by adding new content at the bottom of the file
func ExtractImports ¶
ExtractImports extracts import statements from Go code.
func ExtractPackageLine ¶
ExtractPackageLine extracts the line containing the "package" declaration from Go code.
func FileOrDirectoryExists ¶
Check file or directory exists
func FunctionExistsInFile ¶
this function checks if a certain function exists in a file (golang file)
func GetMD5Hash ¶
func GetThisModuleName ¶
func ImportBaseContent ¶
func InitGoModules ¶
func InstallNeededPackages ¶
func IsGithubUrl ¶
chech if is an github url (package style like github.com/unknowns24/mks)
func ListDirectories ¶
func ListDirectoriesAndFiles ¶
func MakeTemporalDirectory ¶
Make temporary directory with random name and return path
func MoveFileOrDirectory ¶
move file or directory (with contents) to new location
func ParsePromptFile ¶
func ReadFileWithCustomReplace ¶
Read file content, replace placeholder with its values in memory and returns modified content
func RemovePackageAndImports ¶
RemovePackageAndImports removes the package declaration and all import statements from Go code.
func SanitizeFileName ¶
func SliceContainsElement ¶
func ValidateAllDependenciesInstalled ¶
This functions will return a boolean true if all dependencies are installed on templates addons folder or false if at least one of that dependencies are missing, the second parameter will be the slice with the missing ones. Error indicates that something happend during the function execution.
func ValidateTemplateName ¶
func ZipDirectoryContent ¶
Types ¶
type MksTemplatePath ¶
func ProcessMksCustomFilesPath ¶
func ProcessMksCustomFilesPath(fileName string) (MksTemplatePath, error)
type PromptsFileFormat ¶
type PromptsFileFormat struct {
Prompts []Prompt `json:"prompts"`
}