installer

package module
v0.0.0-...-9509cc9 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: MIT Imports: 10 Imported by: 0

README

Go Installer

This package provides a go cross-platform GUI installer to fulfill following use case :

  1. User reads install conditions.
  2. User accepts install conditions.
  3. Installation proceeds and displays progress status on each step.
  4. Display install global success/failure.

Usage

Create an installer by providing a headline title :

i := installer.New("Installation of your app!")

Add one or many conditions to be accepted by the user :

i.AddCondition("Condition1", "Accept this before pursuing installation")

Add one or many installation steps to be executed once the user click on Accept.

i.AddStep(func() error { return nil }, "This step is installing...")

Start the GUI window by providing a window title

i.OpenWindow("Window Title")

Doc

Some convenient steps are provided so you don't have to implement them manually. They all start with AddStep :

i.AddStepRmkDir(...)
i.AddStepCopyFiles(...)

A step is built from a function to process and a description to display to the user. Included steps comes with their intl description.

Because many of process functions are instant, there is a minimal delay of 2 sec for each of them to complete in order to give user a progress feedback.

You can add a custom step by providing a function that returns an error :

i.AddStep(func() error{return nil}, "A custom step description")

Dependencies

The GUI is managed with wails : https://wails.app/

Build

When you build for windows from linux, you need cross compilation libraries available with package build essentials :

sudo apt install mingw-w64
sudo apt-get install build-essential

A typical build command for windows would then be :

GOOS=windows CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc go build -ldflags="-H=windowsgui"

To add an icon to a .exe, an outstanding package is available : https://github.com/tc-hib/go-winres

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(title string) *installer

New creates an installer. Title provided is going to be installer headline inside window GUI. It accepts HTML tags.

From that installer you can :

- add one or more option the user needs to accept - add one or more step that will be triggered once user accepts conditions.

Once added, you can open installer window with the OpenWindow method

Types

This section is empty.

Jump to

Keyboard shortcuts

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