cmd

package
v1.7.2-0...-f26baa4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2020 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BuildModeProd indicates we are building for prod mode
	BuildModeProd = "prod"
	// BuildModeDebug indicates we are building for debug mode
	BuildModeDebug = "debug"
	// BuildModeBridge indicates we are building for bridge mode
	BuildModeBridge = "bridge"
)
View Source
const Version = "v1.7.1"

Version - Wails version

Variables

This section is empty.

Functions

func BuildApplication

func BuildApplication(binaryName string, forceRebuild bool, buildMode string, packageApp bool, projectOptions *ProjectOptions) error

BuildApplication will attempt to build the project based on the given inputs

func BuildDocker

func BuildDocker(binaryName string, buildMode string, projectOptions *ProjectOptions) error

BuildDocker builds the project using the cross compiling wailsapp/xgo:latest container

func BuildFrontend

func BuildFrontend(projectOptions *ProjectOptions) error

BuildFrontend runs the given build command

func BuildNative

func BuildNative(binaryName string, forceRebuild bool, buildMode string, projectOptions *ProjectOptions) error

BuildNative builds on the target platform itself.

func CheckDependencies

func CheckDependencies(logger *Logger) (bool, error)

CheckDependencies will look for Wails dependencies on the system Errors are reported in error and the bool return value is whether the dependencies are all installed.

func CheckDependenciesSilent

func CheckDependenciesSilent(logger *Logger) (bool, error)

CheckDependenciesSilent checks for dependencies but only outputs if there's an error

func CheckIfInstalled

func CheckIfInstalled(application string) (err error)

CheckIfInstalled returns if application is installed

func CheckMewn

func CheckMewn(verbose bool) (err error)

CheckMewn checks if mewn is installed and if not, attempts to fetch it

func CheckWindres

func CheckWindres() (err error)

CheckWindres checks if Windres is installed and if not, aborts

func DpkgInstalled

func DpkgInstalled(packageName string) (bool, error)

DpkgInstalled uses dpkg to see if a package is installed

func EOpkgInstalled

func EOpkgInstalled(packageName string) (bool, error)

EOpkgInstalled uses dpkg to see if a package is installed

func EmbedAssets

func EmbedAssets() ([]string, error)

EmbedAssets will embed the built frontend assets via mewn.

func EqueryInstalled

func EqueryInstalled(packageName string) (bool, error)

EqueryInstalled uses equery to see if a package is installed

func GetCurrentVersion

func GetCurrentVersion() (*semver.Version, error)

func GetWailsVersion

func GetWailsVersion() (*semver.Version, error)

func GoModOutOfSync

func GoModOutOfSync() (bool, error)

func InitializeCrossCompilation

func InitializeCrossCompilation(verbose bool) error

func InstallBridge

func InstallBridge(projectDir string, projectOptions *ProjectOptions) error

InstallBridge installs the relevant bridge javascript library

func InstallFrontendDeps

func InstallFrontendDeps(projectDir string, projectOptions *ProjectOptions, forceRebuild bool, caller string) error

InstallFrontendDeps attempts to install the frontend dependencies based on the given options

func InstallGoDependencies

func InstallGoDependencies(verbose bool) error

InstallGoDependencies will run go get in the current directory

func InstallProdRuntime

func InstallProdRuntime(projectDir string, projectOptions *ProjectOptions) error

InstallProdRuntime installs the production runtime

func InstallRuntime

func InstallRuntime(caller string, projectDir string, projectOptions *ProjectOptions) error

InstallRuntime installs the correct runtime for the type of build

func PackageApplication

func PackageApplication(projectOptions *ProjectOptions) error

PackageApplication will attempt to package the application in a platform dependent way

func PacmanInstalled

func PacmanInstalled(packageName string) (bool, error)

PacmanInstalled uses pacman to see if a package is installed.

func Prompt

func Prompt(question string, defaultValue ...string) string

Prompt asks the user for a value

func PromptRequired

func PromptRequired(question string, defaultValue ...string) string

PromptRequired calls Prompt repeatedly until a value is given

func PromptSelection

func PromptSelection(question string, options []string, optionalDefaultValue ...int) int

PromptSelection asks the user to choose an option

func RequestSupportForDistribution

func RequestSupportForDistribution(distroInfo *DistroInfo) error

RequestSupportForDistribution promts the user to submit a request to support their currently unsupported distribution

func RpmInstalled

func RpmInstalled(packageName string) (bool, error)

RpmInstalled uses rpm to see if a package is installed

func ServeProject

func ServeProject(projectOptions *ProjectOptions, logger *Logger) error

ServeProject attempts to serve up the current project so that it may be connected to via the Wails bridge

func UpdateGoModVersion

func UpdateGoModVersion() error

func ValidateFrontendConfig

func ValidateFrontendConfig(projectOptions *ProjectOptions) error

ValidateFrontendConfig checks if the frontend config is valid

func XbpsInstalled

func XbpsInstalled(packageName string) (bool, error)

XbpsInstalled uses pacman to see if a package is installed.

Types

type Action

type Action func() error

Action represents a function that gets calls when the command is called by the user

type CheckPkgInstalled

type CheckPkgInstalled func(string) (bool, error)

CheckPkgInstalled is all functions that use local programs to see if a package is installed

type Cli

type Cli struct {
	// contains filtered or unexported fields
}

Cli - The main application object

func NewCli

func NewCli(name, description string) *Cli

NewCli - Creates a new Cli application object

func (*Cli) BoolFlag

func (c *Cli) BoolFlag(name, description string, variable *bool) *Command

BoolFlag - Adds a boolean flag to the root command

func (*Cli) Command

func (c *Cli) Command(name, description string) *Command

Command - Adds a command to the application

func (*Cli) DefaultCommand

func (c *Cli) DefaultCommand(defaultCommand *Command) *Cli

DefaultCommand - Sets the given command as the command to run when no other commands given

func (*Cli) PreRun

func (c *Cli) PreRun(callback func(*Cli) error)

PreRun - Calls the given function before running the specific command

func (*Cli) PrintHelp

func (c *Cli) PrintHelp()

PrintHelp - Prints the application's help

func (*Cli) Run

func (c *Cli) Run(args ...string) error

Run - Runs the application with the given arguments

func (*Cli) StringFlag

func (c *Cli) StringFlag(name, description string, variable *string) *Command

StringFlag - Adds a string flag to the root command

func (*Cli) Version

func (c *Cli) Version(version string)

Version - Set the Application version string

type Command

type Command struct {
	Name             string
	CommandPath      string
	Shortdescription string
	Longdescription  string
	AppVersion       string
	SubCommands      []*Command
	SubCommandsMap   map[string]*Command

	ActionCallback Action
	App            *Cli
	Flags          *flag.FlagSet
	// contains filtered or unexported fields
}

Command represents a command that may be run by the user

func NewCommand

func NewCommand(name string, description string, app *Cli, parentCommandPath string) *Command

NewCommand creates a new Command

func (*Command) Action

func (c *Command) Action(callback Action) *Command

Action - Define an action from this command

func (*Command) BoolFlag

func (c *Command) BoolFlag(name, description string, variable *bool) *Command

BoolFlag - Adds a boolean flag to the command

func (*Command) Command

func (c *Command) Command(name, description string) *Command

Command - Defines a subcommand

func (*Command) Hidden

func (c *Command) Hidden()

Hidden hides the command from the Help system

func (*Command) LongDescription

func (c *Command) LongDescription(Longdescription string) *Command

LongDescription - Sets the long description for the command

func (*Command) PrintHelp

func (c *Command) PrintHelp()

PrintHelp - Output the help text for this command

func (*Command) Run

func (c *Command) Run(args []string) error

Run - Runs the Command with the given arguments

func (*Command) StringFlag

func (c *Command) StringFlag(name, description string, variable *string) *Command

StringFlag - Adds a string flag to the command

type Dir

type Dir struct {
	// contains filtered or unexported fields
}

Dir holds information about a directory

func (*Dir) GetAllFilenames

func (d *Dir) GetAllFilenames() (*slicer.StringSlicer, error)

GetAllFilenames returns all filename in and below this directory

func (*Dir) GetSubdirs

func (d *Dir) GetSubdirs() (map[string]string, error)

GetSubdirs will return a list of FQPs to subdirectories in the given directory

type Distribution

type Distribution struct {
	ID       string              `yaml:"id"`
	Releases map[string]*Release `yaml:"releases"`
}

Distribution holds the os-release ID and a map of releases.

func (*Distribution) GetRelease

func (d *Distribution) GetRelease(version string) *Release

GetRelease attempts to return the specific Release information for the given release name. If there is no specific match, the default release data is returned.

type DistroInfo

type DistroInfo struct {
	Distribution LinuxDistribution
	Name         string
	ID           string
	Description  string
	Release      string
}

DistroInfo contains all the information relating to a linux distribution

func GetLinuxDistroInfo

func GetLinuxDistroInfo() *DistroInfo

GetLinuxDistroInfo returns information about the running linux distribution

type FSHelper

type FSHelper struct {
}

FSHelper - Wrapper struct for File System utility commands

func NewFSHelper

func NewFSHelper() *FSHelper

NewFSHelper - Returns a new FSHelper

func (*FSHelper) CopyFile

func (fs *FSHelper) CopyFile(source, target string) error

CopyFile from source to target

func (*FSHelper) CreateFile

func (fs *FSHelper) CreateFile(filename string, data []byte) error

CreateFile creates a file at the given filename location with the contents set to the given data. It will create intermediary directories if needed.

func (*FSHelper) Cwd

func (fs *FSHelper) Cwd() string

Cwd returns the current working directory Aborts on Failure

func (*FSHelper) DirExists

func (fs *FSHelper) DirExists(path string) bool

DirExists - Returns true if the given path resolves to a directory on the filesystem

func (*FSHelper) Directory

func (fs *FSHelper) Directory(dir string) (*Dir, error)

Directory creates a new Dir struct with the given directory path

func (*FSHelper) FileExists

func (fs *FSHelper) FileExists(path string) bool

FileExists returns a boolean value indicating whether the given file exists

func (*FSHelper) FileMD5

func (fs *FSHelper) FileMD5(filename string) (string, error)

FileMD5 returns the md5sum of the given file

func (*FSHelper) FindFile

func (fs *FSHelper) FindFile(path, match string) (string, error)

FindFile returns the first occurrence of match inside path.

func (*FSHelper) LoadAsBytes

func (fs *FSHelper) LoadAsBytes(filename string) ([]byte, error)

LoadAsBytes returns the contents of the file as a byte slice

func (*FSHelper) LoadAsString

func (fs *FSHelper) LoadAsString(filename string) (string, error)

LoadAsString will attempt to load the given file and return its contents as a string

func (*FSHelper) LoadRelativeFile

func (fs *FSHelper) LoadRelativeFile(relativePath string) ([]byte, error)

LoadRelativeFile loads the given file relative to the caller's directory

func (*FSHelper) LocalDir

func (fs *FSHelper) LocalDir(dir string) (*Dir, error)

LocalDir creates a new Dir struct based on a path relative to the caller

func (*FSHelper) MkDir

func (fs *FSHelper) MkDir(dir string) error

MkDir creates the given directory. Returns error on failure

func (*FSHelper) MkDirs

func (fs *FSHelper) MkDirs(fullPath string, mode ...os.FileMode) error

MkDirs creates the given nested directories. Returns error on failure

func (*FSHelper) RemoveFile

func (fs *FSHelper) RemoveFile(filename string) error

RemoveFile removes the given filename

func (*FSHelper) RemoveFiles

func (fs *FSHelper) RemoveFiles(files []string, continueOnError bool) error

RemoveFiles removes the given filenames

func (*FSHelper) SaveAsJSON

func (fs *FSHelper) SaveAsJSON(data interface{}, filename string) error

SaveAsJSON saves the JSON representation of the given data to the given filename

type GitHubHelper

type GitHubHelper struct {
}

GitHubHelper is a utility class for interacting with GitHub

func NewGitHubHelper

func NewGitHubHelper() *GitHubHelper

NewGitHubHelper returns a new GitHub Helper

func (*GitHubHelper) GetLatestPreRelease

func (g *GitHubHelper) GetLatestPreRelease() (result *SemanticVersion, err error)

GetLatestPreRelease gets the latest prerelease on GitHub

func (*GitHubHelper) GetLatestStableRelease

func (g *GitHubHelper) GetLatestStableRelease() (result *SemanticVersion, err error)

GetLatestStableRelease gets the latest stable release on GitHub

func (*GitHubHelper) GetVersionTags

func (g *GitHubHelper) GetVersionTags() ([]*SemanticVersion, error)

GetVersionTags gets the list of tags on the Wails repo It returns a list of sorted tags in descending order

func (*GitHubHelper) IsValidTag

func (g *GitHubHelper) IsValidTag(tagVersion string) (bool, error)

IsValidTag returns true if the given string is a valid tag

type LinuxDB

type LinuxDB struct {
	Distributions map[string]*Distribution `yaml:"distributions"`
}

LinuxDB is the database for linux distribution data.

func NewLinuxDB

func NewLinuxDB() *LinuxDB

NewLinuxDB creates a new LinuxDB instance from the bundled linuxdb.yaml file.

func (*LinuxDB) GetDistro

func (l *LinuxDB) GetDistro(distro string) *Distribution

GetDistro returns the Distribution information for the given distribution name. If the distribution is not supported, nil is returned.

func (*LinuxDB) ImportData

func (l *LinuxDB) ImportData(data []byte) error

ImportData will unmarshal the given YAML formatted data into the LinuxDB

func (*LinuxDB) Load

func (l *LinuxDB) Load(filename string) error

Load will load the given filename from disk and attempt to import the data into the LinuxDB.

type LinuxDistribution

type LinuxDistribution int

LinuxDistribution is of type int

const (
	// Unknown is the catch-all distro
	Unknown LinuxDistribution = iota
	// Debian distribution
	Debian
	// Ubuntu distribution
	Ubuntu
	// Arch linux distribution
	Arch
	// CentOS linux distribution
	CentOS
	// Fedora linux distribution
	Fedora
	// Gentoo distribution
	Gentoo
	// Zorin distribution
	Zorin
	// Parrot distribution
	Parrot
	// Linuxmint distribution
	Linuxmint
	// VoidLinux distribution
	VoidLinux
	// Elementary distribution
	Elementary
	// Kali distribution
	Kali
	// Neon distribution
	Neon
	// ArcoLinux distribution
	ArcoLinux
	// Manjaro distribution
	Manjaro
	// ManjaroARM distribution
	ManjaroARM
	// Deepin distribution
	Deepin
	// Raspbian distribution
	Raspbian
	// Tumbleweed (OpenSUSE) distribution
	Tumbleweed
	// Leap (OpenSUSE) distribution
	Leap
	// ArchLabs distribution
	ArchLabs
	// PopOS distribution
	PopOS
	// Solus distribution
	Solus
)

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger struct

func NewLogger

func NewLogger() *Logger

NewLogger creates a new logger!

func (*Logger) Error

func (l *Logger) Error(format string, a ...interface{})

Error - Outputs an Error message

func (*Logger) Green

func (l *Logger) Green(format string, a ...interface{})

Green - Outputs Green text

func (*Logger) PrintBanner

func (l *Logger) PrintBanner() error

PrintBanner prints the Wails banner before running commands

func (*Logger) PrintSmallBanner

func (l *Logger) PrintSmallBanner(message ...string)

PrintSmallBanner prints a condensed banner

func (*Logger) Red

func (l *Logger) Red(format string, a ...interface{})

Red - Outputs Red text

func (*Logger) SetErrorOnly

func (l *Logger) SetErrorOnly(errorOnly bool)

SetErrorOnly ensures that only errors are logged out

func (*Logger) White

func (l *Logger) White(format string, a ...interface{})

White - Outputs White text

func (*Logger) WhiteUnderline

func (l *Logger) WhiteUnderline(format string, a ...interface{})

WhiteUnderline - Outputs White text with underline

func (*Logger) Yellow

func (l *Logger) Yellow(format string, a ...interface{})

Yellow - Outputs yellow text

func (*Logger) YellowUnderline

func (l *Logger) YellowUnderline(format string, a ...interface{})

YellowUnderline - Outputs Yellow text with underline

func (*Logger) Yellowf

func (l *Logger) Yellowf(format string, a ...interface{})

Yellowf - Outputs yellow text without the newline

type PackageHelper

type PackageHelper struct {
	// contains filtered or unexported fields
}

PackageHelper helps with the 'wails package' command

func NewPackageHelper

func NewPackageHelper(platform string) *PackageHelper

NewPackageHelper creates a new PackageHelper!

func (*PackageHelper) CleanWindows

func (b *PackageHelper) CleanWindows(po *ProjectOptions)

CleanWindows removes any windows related files found in the directory

func (*PackageHelper) Package

func (b *PackageHelper) Package(po *ProjectOptions) error

Package the application into a platform specific package

func (*PackageHelper) PackageWindows

func (b *PackageHelper) PackageWindows(po *ProjectOptions, cleanUp bool) error

PackageWindows packages the application for windows platforms

type PackageManager

type PackageManager int

PackageManager indicates different package managers

const (
	// UNKNOWN package manager
	UNKNOWN PackageManager = iota
	// NPM package manager
	NPM
	// YARN package manager
	YARN
)

type Prerequisite

type Prerequisite struct {
	Name string `yaml:"name"`
	Help string `yaml:"help,omitempty"`
}

Prerequisite is a simple struct containing a program/library name plus the distribution specific help text indicating how to install it.

type Prerequisites

type Prerequisites []*Prerequisite

Prerequisites is a list of things required to use Wails

func GetRequiredLibraries

func GetRequiredLibraries() (*Prerequisites, error)

GetRequiredLibraries returns a list of libraries (packages) required for the platform

func GetRequiredPrograms

func GetRequiredPrograms() (*Prerequisites, error)

GetRequiredPrograms returns a list of programs required for the platform

func (*Prerequisites) Add

func (p *Prerequisites) Add(prereq *Prerequisite)

Add given prereq object to list

type Program

type Program struct {
	Name string `json:"name"`
	Path string `json:"path"`
	// contains filtered or unexported fields
}

Program - A struct to define an installed application/binary

func (*Program) GetFullPathToBinary

func (p *Program) GetFullPathToBinary() (string, error)

GetFullPathToBinary returns the full path the the current binary

func (*Program) Run

func (p *Program) Run(vars ...string) (stdout, stderr string, exitCode int, err error)

Run will execute the program with the given parameters Returns stdout + stderr as strings and an error if one occurred

type ProgramHelper

type ProgramHelper struct {
	// contains filtered or unexported fields
}

ProgramHelper - Utility functions around installed applications

func NewProgramHelper

func NewProgramHelper(verbose ...bool) *ProgramHelper

NewProgramHelper - Creates a new ProgramHelper

func (*ProgramHelper) FindProgram

func (p *ProgramHelper) FindProgram(programName string) *Program

FindProgram attempts to find the given program on the system.FindProgram Returns a struct with the name and path to the program

func (*ProgramHelper) InstallGoPackage

func (p *ProgramHelper) InstallGoPackage(packageName string) error

InstallGoPackage installs the given Go package

func (*ProgramHelper) InstallNPMPackage

func (p *ProgramHelper) InstallNPMPackage(packageName string, save bool) error

InstallNPMPackage installs the given npm package

func (*ProgramHelper) IsInstalled

func (p *ProgramHelper) IsInstalled(programName string) bool

IsInstalled tries to determine if the given binary name is installed

func (*ProgramHelper) RunCommand

func (p *ProgramHelper) RunCommand(command string) error

RunCommand runs the given command

func (*ProgramHelper) RunCommandArray

func (p *ProgramHelper) RunCommandArray(args []string, dir ...string) error

RunCommandArray runs the command specified in the array

type ProjectHelper

type ProjectHelper struct {
	// contains filtered or unexported fields
}

ProjectHelper is a helper struct for managing projects

func NewProjectHelper

func NewProjectHelper() *ProjectHelper

NewProjectHelper creates a new Project helper struct

func (*ProjectHelper) GenerateProject

func (ph *ProjectHelper) GenerateProject(projectOptions *ProjectOptions) error

GenerateProject generates a new project using the options given

func (*ProjectHelper) LoadProjectConfig

func (ph *ProjectHelper) LoadProjectConfig(dir string) (*ProjectOptions, error)

LoadProjectConfig loads the project config from the given directory

func (*ProjectHelper) NewProjectOptions

func (ph *ProjectHelper) NewProjectOptions() *ProjectOptions

NewProjectOptions creates a new default set of project options

type ProjectOptions

type ProjectOptions struct {
	Name            string    `json:"name"`
	Description     string    `json:"description"`
	Author          *author   `json:"author,omitempty"`
	Version         string    `json:"version"`
	OutputDirectory string    `json:"-"`
	UseDefaults     bool      `json:"-"`
	Template        string    `json:"-"`
	BinaryName      string    `json:"binaryname"`
	FrontEnd        *frontend `json:"frontend,omitempty"`
	NPMProjectName  string    `json:"-"`

	WailsVersion string

	Verbose      bool `json:"-"`
	CrossCompile bool
	Platform     string
	Architecture string
	LdFlags      string
	// contains filtered or unexported fields
}

ProjectOptions holds all the options available for a project

func (*ProjectOptions) Defaults

func (po *ProjectOptions) Defaults()

Defaults sets the default project template

func (*ProjectOptions) GetNPMBinaryName

func (po *ProjectOptions) GetNPMBinaryName() (PackageManager, error)

GetNPMBinaryName returns the type of package manager used by the project

func (*ProjectOptions) LoadConfig

func (po *ProjectOptions) LoadConfig(projectDir string) error

LoadConfig loads the project configuration file from the given directory

func (*ProjectOptions) PromptForInputs

func (po *ProjectOptions) PromptForInputs() error

PromptForInputs asks the user to input project details

func (*ProjectOptions) SetTypescriptDefsFilename

func (po *ProjectOptions) SetTypescriptDefsFilename(filename string)

SetTypescriptDefsFilename indicates that we want to generate typescript bindings to the given file

func (*ProjectOptions) WriteProjectConfig

func (po *ProjectOptions) WriteProjectConfig() error

WriteProjectConfig writes the project configuration into the project directory

type Release

type Release struct {
	Name              string          `yaml:"name"`
	Version           string          `yaml:"version"`
	GccVersionCommand string          `yaml:"gccversioncommand"`
	Programs          []*Prerequisite `yaml:"programs"`
	Libraries         []*Prerequisite `yaml:"libraries"`
}

Release holds the name and version of the release as given by os-release. Programs is a slice of dependant programs required to be present on the local installation for Wails to function. Libraries is a slice of libraries that must be present for Wails applications to compile.

type SemanticVersion

type SemanticVersion struct {
	Version *semver.Version
}

SemanticVersion is a struct containing a semantic version

func NewSemanticVersion

func NewSemanticVersion(version string) (*SemanticVersion, error)

NewSemanticVersion creates a new SemanticVersion object with the given version string

func (*SemanticVersion) IsGreaterThan

func (s *SemanticVersion) IsGreaterThan(version *SemanticVersion) (bool, error)

IsGreaterThan returns true if this version is greater than the given version

func (*SemanticVersion) IsGreaterThanOrEqual

func (s *SemanticVersion) IsGreaterThanOrEqual(version *SemanticVersion) (bool, error)

IsGreaterThanOrEqual returns true if this version is greater than or equal the given version

func (*SemanticVersion) IsPreRelease

func (s *SemanticVersion) IsPreRelease() bool

IsPreRelease returns true if it's a prerelease version

func (*SemanticVersion) IsRelease

func (s *SemanticVersion) IsRelease() bool

IsRelease returns true if it's a release version

func (*SemanticVersion) MainVersion

func (s *SemanticVersion) MainVersion() *SemanticVersion

MainVersion returns the main version of any version+prerelease+metadata EG: MainVersion("1.2.3-pre") => "1.2.3"

func (*SemanticVersion) String

func (s *SemanticVersion) String() string

type SemverCollection

type SemverCollection []*SemanticVersion

SemverCollection is a collection of SemanticVersion objects

func (SemverCollection) Len

func (c SemverCollection) Len() int

Len returns the length of a collection. The number of Version instances on the slice.

func (SemverCollection) Less

func (c SemverCollection) Less(i, j int) bool

Less is needed for the sort interface to compare two Version objects on the slice. If checks if one is less than the other.

func (SemverCollection) Swap

func (c SemverCollection) Swap(i, j int)

Swap is needed for the sort interface to replace the Version objects at two different positions in the slice.

type ShellHelper

type ShellHelper struct {
	// contains filtered or unexported fields
}

ShellHelper helps with Shell commands

func NewShellHelper

func NewShellHelper() *ShellHelper

NewShellHelper creates a new ShellHelper!

func (*ShellHelper) Run

func (sh *ShellHelper) Run(command string, vars ...string) (stdout, stderr string, err error)

Run the given command

func (*ShellHelper) RunInDirectory

func (sh *ShellHelper) RunInDirectory(dir string, command string, vars ...string) (stdout, stderr string, err error)

RunInDirectory runs the given command in the given directory

func (*ShellHelper) SetVerbose

func (sh *ShellHelper) SetVerbose()

SetVerbose sets the verbose flag

type SystemConfig

type SystemConfig struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

SystemConfig - Defines system wode configuration data

func NewSystemConfig

func NewSystemConfig(filename string) (*SystemConfig, error)

NewSystemConfig - Creates a new SystemConfig helper object

func (*SystemConfig) Save

func (sc *SystemConfig) Save(filename string) error

Save - Saves the system config to the given filename

type SystemHelper

type SystemHelper struct {
	// contains filtered or unexported fields
}

SystemHelper - Defines everything related to the system

func NewSystemHelper

func NewSystemHelper() *SystemHelper

NewSystemHelper - Creates a new System Helper

func (*SystemHelper) BackupConfig

func (s *SystemHelper) BackupConfig() (string, error)

BackupConfig attempts to backup the system config file

func (*SystemHelper) CheckInitialised

func (s *SystemHelper) CheckInitialised() error

CheckInitialised checks if the system has been set up and if not, runs setup

func (*SystemHelper) ConfigFileExists

func (s *SystemHelper) ConfigFileExists() bool

ConfigFileExists - Returns true if it does!

func (*SystemHelper) ConfigFileIsValid

func (s *SystemHelper) ConfigFileIsValid() bool

ConfigFileIsValid checks if the config file is valid

func (*SystemHelper) GetAuthor

func (s *SystemHelper) GetAuthor() (string, error)

GetAuthor returns a formatted string of the user's name and email

func (*SystemHelper) Initialise

func (s *SystemHelper) Initialise() error

Initialise attempts to set up the Wails system. An error is returns if there is a problem

func (*SystemHelper) LoadConfig

func (s *SystemHelper) LoadConfig() (*SystemConfig, error)

LoadConfig attempts to load the Wails system config

type TemplateDependency

type TemplateDependency struct {
	Bin  string `json:"bin"`
	Help string `json:"help"`
}

TemplateDependency defines a binary dependency for the template EG: ng for angular

type TemplateDetails

type TemplateDetails struct {
	Name     string
	Path     string
	Metadata *TemplateMetadata
	// contains filtered or unexported fields
}

TemplateDetails holds information about a specific template

type TemplateHelper

type TemplateHelper struct {
	// contains filtered or unexported fields
}

TemplateHelper is a utility object to help with processing templates

func NewTemplateHelper

func NewTemplateHelper() *TemplateHelper

NewTemplateHelper creates a new template helper

func (*TemplateHelper) CreateNewTemplate

func (t *TemplateHelper) CreateNewTemplate(dirname string, details *TemplateMetadata) (string, error)

CreateNewTemplate creates a new template based on the given directory name and string

func (*TemplateHelper) GetTemplateDetails

func (t *TemplateHelper) GetTemplateDetails() (map[string]*TemplateDetails, error)

GetTemplateDetails returns a map of Template structs containing details of the found templates

func (*TemplateHelper) GetTemplateFilenames

func (t *TemplateHelper) GetTemplateFilenames(template *TemplateDetails) (*slicer.StringSlicer, error)

GetTemplateFilenames returns all the filenames of the given template

func (*TemplateHelper) InstallTemplate

func (t *TemplateHelper) InstallTemplate(projectPath string, projectOptions *ProjectOptions) error

InstallTemplate installs the template given in the project options to the project path given

func (*TemplateHelper) IsValidTemplate

func (t *TemplateHelper) IsValidTemplate(templateName string) bool

IsValidTemplate returns true if the given template name resides on disk

func (*TemplateHelper) LoadMetadata

func (t *TemplateHelper) LoadMetadata(dir string) (*TemplateMetadata, error)

LoadMetadata loads the template's 'metadata.json' file

func (*TemplateHelper) SanitizeFilename

func (t *TemplateHelper) SanitizeFilename(name string) string

SanitizeFilename sanitizes the given string to make a valid filename

type TemplateMetadata

type TemplateMetadata struct {
	Name                 string                `json:"name"`
	Version              string                `json:"version"`
	ShortDescription     string                `json:"shortdescription"`
	Description          string                `json:"description"`
	Install              string                `json:"install"`
	Build                string                `json:"build"`
	Author               string                `json:"author"`
	Created              string                `json:"created"`
	FrontendDir          string                `json:"frontenddir"`
	Serve                string                `json:"serve"`
	Bridge               string                `json:"bridge"`
	WailsDir             string                `json:"wailsdir"`
	TemplateDependencies []*TemplateDependency `json:"dependencies,omitempty"`
}

TemplateMetadata holds all the metadata for a Wails template

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL