CLI

    It has a number of commands:

    This will output the cli help message with all the available commands and flags.

    Setup

    wails setup

    The setup command does a number of things - it asks you for your name and email so that it can fill in project templates with your details. It also checks to see if your environment has the dependencies it needs and if not, try to suggest ways on how to install those dependencies.

    Setup is also the default command so it can be invoked by simply running .

    Your browser does not support the video tag.
    Your browser does not support the video tag.

    The init command builds out a new project based on a template of your choice. We curently support a basic Vue, Vuetify and React templates. The project will be built automatically after initialisation.

    Basic Vue

    Vuetify

    This template consists of a frontend composed of Vuetify components, bundled together using Webpack. It makes a simple call to the backend.

    React

    This template consists of a frontend composed of React components, bundled together using Webpack. It makes a simple call to the backend.

    Your browser does not support the video tag.
    Your browser does not support the video tag.

    Serve

    wails serve

    When you run wails serve, it will compile up the backend and run it in headless mode. This allows you to develop the frontend using your standard tooling. When you run your app, it will connect to the backend at startup and make all your backend functions available to you.

    We will cover this more in the tutorial.

    Your browser does not support the video tag.
    Your browser does not support the video tag.

    The build command is the Wails equivalent of go build, however it does a number of things:

    • Installs frontend dependencies if needed
    • Performs a build of the frontend
    • Packs the frontend using Webpack
    • It finally compiles and bundles everything into a single binary
    Your browser does not support the video tag.
    Your browser does not support the video tag.

    Build Flags

    Here is a list of all available flags:

    wails update

    This command does a check to see if the current version is the latest. If not, it will download and install the latest version. It is possible to also use it to install ‘prerelease’ versions by using the -pre flag. If a specific version is required, then it supports a flag.

    Example: wails update -pre will update the latest prerelease version

    Issue

    This command speeds up the process for submitting an issue to the Wails project. When you run the command, you will be asked to answer a couple of questions:

    Wails then determines some environmental details such as it’s own version, opens a browser and fills in the default issue template.

    CLI - 图2

    You now have a good basis for your template. Running wails init will now give you your template as an option to install. When the project is generated using the template, it will create directories, copy non-template files then copy template files. Template files end in .template and will be treated as standard Go templates in which embedded codes are substituted with values in the .