5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-06 20:01:37 +08:00
wails/v3/cmd/wails3/main.go
Mohamed Gharib e419822c77
[v3] Fix default context-menu in selected disabled inputs (#2753)
* [v3] Fix default context-menu in selected disabled inputs

* [v3] Update Task to v3.27.1. Add `wails3 task -version` and `wails3 task taskfile:update`.

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2023-07-01 10:52:55 +10:00

54 lines
1.9 KiB
Go

package main
import (
"github.com/pterm/pterm"
"github.com/samber/lo"
"os"
"runtime/debug"
"github.com/leaanthony/clir"
"github.com/wailsapp/wails/v3/internal/commands"
)
func init() {
buildInfo, ok := debug.ReadBuildInfo()
if !ok {
return
}
commands.BuildSettings = lo.Associate(buildInfo.Settings, func(setting debug.BuildSetting) (string, string) {
return setting.Key, setting.Value
})
// Iterate over the Deps and add them to the build settings using a prefix of "mod."
for _, dep := range buildInfo.Deps {
commands.BuildSettings["mod."+dep.Path] = dep.Version
}
}
func main() {
app := clir.NewCli("wails", "The Wails CLI", "v3")
app.NewSubCommandFunction("build", "Build the project", commands.Build)
app.NewSubCommandFunction("init", "Initialise a new project", commands.Init)
task := app.NewSubCommand("task", "Run and list tasks")
var taskFlags commands.RunTaskOptions
task.AddFlags(&taskFlags)
task.Action(func() error {
return commands.RunTask(&taskFlags, task.OtherArgs())
})
task.LongDescription("\nUsage: wails task [taskname] [flags]\n\nTasks are defined in the `Taskfile.yaml` file. See https://taskfile.dev for more information.")
generate := app.NewSubCommand("generate", "Generation tools")
generate.NewSubCommandFunction("defaults", "Generate default build assets", commands.Defaults)
generate.NewSubCommandFunction("icons", "Generate icons", commands.GenerateIcons)
generate.NewSubCommandFunction("syso", "Generate Windows .syso file", commands.GenerateSyso)
generate.NewSubCommandFunction("bindings", "Generate bindings + models", commands.GenerateBindings)
plugin := app.NewSubCommand("plugin", "Plugin tools")
//plugin.NewSubCommandFunction("list", "List plugins", commands.PluginList)
plugin.NewSubCommandFunction("init", "Initialise a new plugin", commands.PluginInit)
//plugin.NewSubCommandFunction("add", "Add a plugin", commands.PluginAdd)
err := app.Run()
if err != nil {
pterm.Error.Println(err)
os.Exit(1)
}
}