Documentation
¶
Index ¶
- Constants
- func BuildApplication(binaryName string, forceRebuild bool, buildMode string, packageApp bool, ...) error
- func BuildFrontend(buildCommand string) error
- func CheckDependencies(logger *Logger) (bool, error)
- func CheckDependenciesSilent(logger *Logger) (bool, error)
- func CheckMewn() (err error)
- func CheckWindres() (err error)
- func DpkgInstalled(packageName string) (bool, error)
- func InstallFrontendDeps(projectDir string, projectOptions *ProjectOptions, forceRebuild bool, ...) error
- func InstallGoDependencies() error
- func PackageApplication(projectOptions *ProjectOptions) error
- func Prompt(question string, defaultValue ...string) string
- func PromptRequired(question string, defaultValue ...string) string
- func PromptSelection(question string, options []string, optionalDefaultValue ...int) int
- func ServeProject(projectOptions *ProjectOptions, logger *Logger) error
- func ValidateFrontendConfig(projectOptions *ProjectOptions) error
- type Action
- type Cli
- func (c *Cli) BoolFlag(name, description string, variable *bool) *Command
- func (c *Cli) Command(name, description string) *Command
- func (c *Cli) DefaultCommand(defaultCommand *Command) *Cli
- func (c *Cli) PreRun(callback func(*Cli) error)
- func (c *Cli) PrintHelp()
- func (c *Cli) Run(args ...string) error
- func (c *Cli) StringFlag(name, description string, variable *string) *Command
- func (c *Cli) Version(version string)
- type Command
- func (c *Command) Action(callback Action) *Command
- func (c *Command) BoolFlag(name, description string, variable *bool) *Command
- func (c *Command) Command(name, description string) *Command
- func (c *Command) LongDescription(Longdescription string) *Command
- func (c *Command) PrintHelp()
- func (c *Command) Run(args []string) error
- func (c *Command) StringFlag(name, description string, variable *string) *Command
- type DistroInfo
- type FSHelper
- func (fs *FSHelper) CopyFile(source, target string) error
- func (fs *FSHelper) CreateFile(filename string, data []byte) error
- func (fs *FSHelper) Cwd() string
- func (fs *FSHelper) DirExists(path string) bool
- func (fs *FSHelper) FileExists(path string) bool
- func (fs *FSHelper) FileMD5(filename string) (string, error)
- func (fs *FSHelper) GetSubdirs(dir string) (map[string]string, error)
- func (fs *FSHelper) LoadAsString(filename string) (string, error)
- func (fs *FSHelper) MkDir(dir string) error
- func (fs *FSHelper) MkDirs(fullPath string, mode ...os.FileMode) error
- func (fs *FSHelper) RemoveFile(filename string) error
- func (fs *FSHelper) RemoveFiles(files []string) error
- type LinuxDistribution
- type Logger
- func (l *Logger) Error(format string, a ...interface{})
- func (l *Logger) Green(format string, a ...interface{})
- func (l *Logger) PrintBanner() error
- func (l *Logger) PrintSmallBanner(message ...string)
- func (l *Logger) Red(format string, a ...interface{})
- func (l *Logger) SetErrorOnly(errorOnly bool)
- func (l *Logger) White(format string, a ...interface{})
- func (l *Logger) WhiteUnderline(format string, a ...interface{})
- func (l *Logger) Yellow(format string, a ...interface{})
- func (l *Logger) YellowUnderline(format string, a ...interface{})
- func (l *Logger) Yellowf(format string, a ...interface{})
- type PackageHelper
- type Prerequisite
- type Prerequisites
- type Program
- type ProgramHelper
- func (p *ProgramHelper) FindProgram(programName string) *Program
- func (p *ProgramHelper) InstallGoPackage(packageName string) error
- func (p *ProgramHelper) IsInstalled(programName string) bool
- func (p *ProgramHelper) RunCommand(command string) error
- func (p *ProgramHelper) RunCommandArray(args []string) error
- type ProjectHelper
- type ProjectOptions
- type ShellHelper
- type SystemConfig
- type SystemHelper
- type Template
- type TemplateDetails
- type TemplateHelper
- type TemplateList
- type TemplateMetadata
Constants ¶
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" )
const Version = "v0.11.3"
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 BuildFrontend ¶
BuildFrontend runs the given build command
func CheckDependencies ¶
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 ¶
CheckDependenciesSilent checks for dependencies but only outputs if there's an error
func CheckMewn ¶
func CheckMewn() (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 ¶
DpkgInstalled uses dpkg to see if a package is installed
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() error
InstallGoDependencies will run go get in the current directory
func PackageApplication ¶
func PackageApplication(projectOptions *ProjectOptions) error
PackageApplication will attempt to package the application in a pltform dependent way
func PromptRequired ¶
PromptRequired calls Prompt repeatedly until a value is given
func PromptSelection ¶
PromptSelection asks the user to choose an option
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 ValidateFrontendConfig ¶
func ValidateFrontendConfig(projectOptions *ProjectOptions) error
ValidateFrontendConfig checks if the frontend config is valid
Types ¶
type Action ¶
type Action func() error
Action represents a function that gets calls when the command is called by the user
type Cli ¶
type Cli struct {
// contains filtered or unexported fields
}
Cli - The main application object
func (*Cli) DefaultCommand ¶
DefaultCommand - Sets the given command as the command to run when no other commands given
func (*Cli) StringFlag ¶
StringFlag - Adds a string flag to the root command
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 ¶
NewCommand creates a new Command
func (*Command) LongDescription ¶
LongDescription - Sets the long description for the command
func (*Command) PrintHelp ¶
func (c *Command) PrintHelp()
PrintHelp - Output the help text for this command
type DistroInfo ¶
type DistroInfo struct {
Distribution LinuxDistribution
Description string
Release string
Codename string
DistributorID 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 (*FSHelper) CreateFile ¶ added in v0.9.5
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) DirExists ¶
DirExists - Returns true if the given path resolves to a directory on the filesystem
func (*FSHelper) FileExists ¶
FileExists returns a boolean value indicating whether the given file exists
func (*FSHelper) GetSubdirs ¶
GetSubdirs will return a list of FQPs to subdirectories in the given directory
func (*FSHelper) LoadAsString ¶
LoadAsString will attempt to load the given file and return its contents as a string
func (*FSHelper) RemoveFile ¶
RemoveFile removes the given filename
func (*FSHelper) RemoveFiles ¶
RemoveFiles removes the given filenames
type LinuxDistribution ¶
type LinuxDistribution int
LinuxDistribution is of type int
const ( // Unknown is the catch-all distro Unknown LinuxDistribution = 0 // Ubuntu distribution Ubuntu LinuxDistribution = 1 )
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger struct
func (*Logger) PrintBanner ¶
PrintBanner prints the Wails banner before running commands
func (*Logger) PrintSmallBanner ¶
PrintSmallBanner prints a condensed banner
func (*Logger) SetErrorOnly ¶
SetErrorOnly ensures that only errors are logged out
func (*Logger) WhiteUnderline ¶
WhiteUnderline - Outputs White text with underline
func (*Logger) YellowUnderline ¶
YellowUnderline - Outputs Yellow text with underline
type PackageHelper ¶
type PackageHelper struct {
// contains filtered or unexported fields
}
PackageHelper helps with the 'wails package' command
func NewPackageHelper ¶
func NewPackageHelper() *PackageHelper
NewPackageHelper creates a new PackageHelper!
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 Prerequisite ¶
Prerequisite defines a Prerequisite!
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 ¶
Program - A struct to define an installed application/binary
func (*Program) GetFullPathToBinary ¶
GetFullPathToBinary returns the full path the the current binary
type ProgramHelper ¶
type ProgramHelper struct {
// contains filtered or unexported fields
}
ProgramHelper - Utility functions around installed applications
func NewProgramHelper ¶
func NewProgramHelper() *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) 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) 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:"-"`
// 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) 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) WriteProjectConfig ¶
func (po *ProjectOptions) WriteProjectConfig() error
WriteProjectConfig writes the project configuration into the project directory
type SystemConfig ¶
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) 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 TemplateDetails ¶ added in v0.9.5
type TemplateDetails struct {
BasePath string
Path string
Metadata *TemplateMetadata
}
TemplateDetails holds information about a specific template
type TemplateHelper ¶
type TemplateHelper struct {
TemplateList *TemplateList
Files *mewnlib.FileGroup
}
TemplateHelper is a utility object to help with processing templates
func NewTemplateHelper ¶
func NewTemplateHelper() *TemplateHelper
NewTemplateHelper creates a new template helper
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
type TemplateList ¶ added in v0.9.5
type TemplateList struct {
// contains filtered or unexported fields
}
TemplateList is a list of available templates
func NewTemplateList ¶ added in v0.9.5
func NewTemplateList(filenames *mewnlib.FileGroup) *TemplateList
NewTemplateList creates a new TemplateList object
type TemplateMetadata ¶ added in v0.9.5
type TemplateMetadata struct {
Name string `json:"name"`
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"`
}
TemplateMetadata holds all the metadata for a Wails template