github.com/pluralsh/plural-cli@v0.9.5/pkg/ui/ui.go (about)

     1  //go:build ui || generate
     2  
     3  package ui
     4  
     5  import (
     6  	"embed"
     7  
     8  	"github.com/urfave/cli"
     9  	"github.com/wailsapp/wails/v2"
    10  	"github.com/wailsapp/wails/v2/pkg/options"
    11  	"github.com/wailsapp/wails/v2/pkg/options/assetserver"
    12  
    13  	"github.com/pluralsh/plural-cli/pkg/api"
    14  )
    15  
    16  //go:embed all:web/dist
    17  var assets embed.FS
    18  
    19  func Run(c api.Client, ctx *cli.Context) error {
    20  	// Create an instance of the main window structure
    21  	window := NewWindow()
    22  	client := NewClient(c, ctx)
    23  
    24  	// Create application with options
    25  	err := wails.Run(&options.App{
    26  		Title:     "Plural",
    27  		Frameless: true,
    28  		Width:     window.width(),
    29  		Height:    window.height(),
    30  		AssetServer: &assetserver.Options{
    31  			Assets: assets,
    32  		},
    33  		OnStartup: window.startup,
    34  		Bind: []interface{}{
    35  			window,
    36  			client,
    37  		},
    38  	})
    39  
    40  	return err
    41  }