text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>")); err == nil {
return nil
}
// Create target directory if it doesn't exist
err := os.MkdirAll(options.Directory, 0755)
if err != nil {
return fmt.Errorf("failed to create target directory: %w", err)
}
// Write to target directory
targetPath := filepath.Join(options.Directory, "MicrosoftEdg... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"bytes"
"errors"
"fmt"
"image"
"image/color"
"image/png"
"os"
"os/exec"
"path/filepath"
"runtime"
"strconv"
"strings"
"github.com/jackmordaunt/icns/v2"
"github.com/leaanthony/winicon"
"github.com/wailsapp/wails/v3/internal/operatingsystem"
"howett.net/plist"
)
... | fim | wailsapp/wails | go |
<|fim_suffix|> if f.Size() != 571 {
return fmt.Errorf("appicon.ico is not the correct size. Got %d", f.Size())
}
if f.IsDir() {
return fmt.Errorf("appicon.ico is a directory")
}
if f.Size() == 0 {
return fmt.Errorf("appicon.ico is empty")
}
return nil
},
},
{
name: "shou... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"errors"
"fmt"
"net/url"
"os"
"path/filepath"
"regexp"
"strings"
"github.com/go-git/go-git/v5/config"
"github.com/wailsapp/wails/v3/internal/defaults"
"github.com/wailsapp/wails/v3/internal/term"
"github.com/go-git/go-git/v5"
"github.com/pterm/pterm"
"github.com/w... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"testing"
)
func TestGitURLToModulePath(t *testing.T) {
tests := []struct {
name string
gitURL string
want string
}{
{
name: "Simple GitHub URL",
gitURL: "github.com/username/project",
want: "github.com/username/project",
},
{
name: "GitHub ... | fim | wailsapp/wails | go |
<|fim_suffix|>.MkdirAll(genDir, 0o755); err != nil {
return err
}
genGo := filepath.Join(genDir, "main_ios.gen.go")
if err := os.WriteFile(genGo, content, 0o644); err != nil {
return err
}
// Determine app dir (current working directory)
appDir, err := os.Getwd()
if err != nil {
return err
}
virtual := ... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"bytes"
"fmt"
"image"
"image/png"
"io"
"io/fs"
"os"
"path/filepath"
"text/template"
"golang.org/x/image/draw"
"gopkg.in/yaml.v3"
)
// IOSXcodeGenOptions holds parameters for Xcode project generation.
type IOSXcodeGenOptions struct {
OutDir string `description:"Outp... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"embed"
"encoding/json"
"fmt"
"os"
"os/exec"
"path/filepath"
"runtime"
"text/template"
"github.com/wailsapp/wails/v3/internal/flags"
)
//go:embed build_assets/windows/msix/*
var msixAssets embed.FS
// MSIXOptions represents the configuration for MSIX packaging
type M... | fim | wailsapp/wails | go |
<|fim_prefix|><|fim_suffix|>n.String()
if options.Version != "" {
currentVersion = options.Version
}
releaseNotes := github.GetReleaseNotes(currentVersion, options.NoColour)
term.Println(releaseNotes)
return nil
}
<|fim_middle|>package commands
import (
"github.com/wailsapp/wails/v3/internal/github"
"github.... | fim | wailsapp/wails | go |
<|fim_suffix|>DebugJS := filepath.Join(bundledAssetsDir, "runtime.debug.js")
err = CopyFile(runtimeDebugJS, filepath.Join(options.Directory, "runtime-debug.js"))
if err != nil {
return err
}
return nil
}
func CopyFile(source string, target string) error {
s, err := os.Open(source)
if err != nil {
return err
... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"github.com/wailsapp/wails/v3/internal/flags"
"github.com/wailsapp/wails/v3/i<|fim_suffix|>tput()
}
if options.PackageName == "" {
options.PackageName = toCamelCasePlugin(options.Name)
}
return service.Install(options)
}
<|fim_middle|>nternal/service"
"github.com/wail... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"github.com/wail<|fim_suffix|>ns) error {
DisableFooter = true
wizard := setupwizard.New()
return wizard.Run()
}
<|fim_middle|>sapp/wails/v3/internal/setupwizard"
)
type SetupOptions struct{}
func Setup(_ *SetupOptio<|endoftext|> | fim | wailsapp/wails | go |
<|fim_suffix|> fmt.Errorf("--identity is required for macOS signing")
}
if options.Verbose {
pterm.Info.Printfln("Signing macOS app bundle: %s", options.Input)
}
// Build codesign command
args := []string{
"--force",
"--deep",
"--sign", options.Identity,
}
if options.Entitlements != "" {
args = appe... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"github.com/ProtonMail/go-crypto/openpgp"
"github.com/ProtonMail/go-crypto/openpgp/armor"
"github.com/ProtonMail/go-crypto/openpgp/packet"
"github.com/charmbracelet/huh"
"github.com/pterm/pterm"
"github.com/wa... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"fmt"
"os"
"runtime"
"github.com/tc-hib/winres"
"github.com/tc-hib/winres/version"
)
type SysoOptions struct {
Manifest string `description:"The manifest file"`
Info string `description:"The info.json file"`
Icon string `description:"The icon file"`
Out s... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"path/filepath"
"runtime"
"testing"
)
func TestGenerateSyso(t *testing.T) {
tests := []struct {
name string
setup func() *SysoOptions
wantErr bool
test func() error
}{
{
name: "should error if manifest filename is not provided",
setup: func() *SysoO... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"context"
"fmt"
"os"
"path/filepath"
"strings"
"time"
"github.com/wailsapp/wails/v3/internal/term"
"github.com/wailsapp/wails/v3/internal/wake"
"github.com/wailsapp/task/v3"
"github.com/wailsapp/task/v3/taskfile/ast"
)
// wakeRoutableInvocation reports whether `wail... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"bytes"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/wailsapp/task/v3/taskfile/ast"
)
func TestTaskParameterPassing(t *testing.T) {
// Skip if running in CI without proper en... | fim | wailsapp/wails | go |
<|fim_suffix|>
} else if len(otherArgs) > 0 {
// Use otherArgs directly if provided
tasksAndVars = otherArgs
} else {
// Fall back to parsing os.Args for backward compatibility
var index int
var arg string
for index, arg = range os.Args[2:] {
if len(arg) > 0 && arg[0] != '-' {
break
}
}
for... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"os"
"runtime"
"strings"
"github.com/wailsapp/wails/v3/internal/flags"
"github.com/wailsapp/wails/v3/internal/term"
"github.com/wailsapp/wails/v3/internal/wake"
)
// runTaskFunc is a variable to allow mocking in tests
var runTaskFunc = RunTask
// validPlatforms for GOOS... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"os"
"runtime"
"testing"
"github.com/stretchr/testify/assert"
"github.com/wailsapp/wails/v3/internal/flags"
)
func TestWrapTask(t *testing.T) {
// Get current platform info for expected values
currentOS := runtime.GOOS
currentArch := runtime.GOARCH
tests := []struct ... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/wailsapp/wails/v3/internal/templates"
)
func TestBinaryNameNormalization(t *testing.T) {
tests := []struct {
projectName string
expected string
}{
{"Wails... | fim | wailsapp/wails | go |
<|fim_suffix|>,
path: "build_assets/Taskfile.tmpl.yml",
want: []string{
"ref: .OBFUSCATED",
" -obfuscated",
},
},
{
name: "darwin taskfile",
path: "build_assets/darwin/Taskfile.yml",
want: []string{
"command -v garble",
"garble {{.GARBLE_ARGS}} build",
"wails_obfuscated",
"... | fim | wailsapp/wails | go |
package commands
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestWindowsTaskfilePassesArchToSyso(t *testing.T) {
data, err := buildAssets.ReadFile("build_assets/windows/Taskfile.yml")
require.NoError(t, err)
content := string(data)
t.Run("b... | fim | wailsapp/wails | go |
<|fim_suffix|>!= nil {
return err
}
fmt.Printf("%+v\n", info)
return nil
}
<|fim_prefix|>package commands
import (
"fmt"
"github.com/wailsapp/wails/v3/internal/buildinfo"
)
type BuildInfoOptions struct{}
func BuildInfo(_ *BuildInfoOptions) error {
info, err := buildinfo.Get()
<|fim_middle|>if err <|endofte... | fim | wailsapp/wails | go |
<|fim_suffix|>("port %d is not open on %s", options.Port, options.Host)
}
return nil
}
<|fim_prefix|>package commands
import (
"fmt"
"net"
"net/url"
"strconv"
"time"
)
type ToolCheckPortOptions struct {
URL string `name:"u" description:"URL to check"`
Host string `name:"h" description:"Host to check" defaul... | fim | wailsapp/wails | go |
<|fim_suffix|>e and destination from os.Args
if len(os.Args) != 5 {
return fmt.Errorf("cp requires a source and destination")
}
// Extract source
source := os.Args[3]
for _, destination := range os.Args[4:] {
src, err := filepath.Abs(source)
if err != nil {
return err
}
dst, err := filepath.Abs(destin... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"fmt"
"os"
"os/exec"
"path"
"path/filepath"
"strings"
"golang.org/x/mod/modfile"
)
// DockerMountsOptions holds options for the docker-mounts command.
type DockerMountsOptions struct{}
// HasCCOptions holds options for the has-cc command.
type HasCCOptions struct{}
//... | fim | wailsapp/wails | go |
<|fim_suffix|>p
go 1.25
replace foo => C:\vendor\lib
`)
out, err := captureStdout(t, func() error { return ToolDockerMounts(&DockerMountsOptions{}) })
if err != nil {
t.Fatalf("ToolDockerMounts returned error: %v", err)
}
if strings.Contains(out, `vendor/lib`) {
t.Errorf("drive-letter path should be skipped,... | fim | wailsapp/wails | go |
<|fim_suffix|>rsal binary: %w", err)
}
return nil
}
<|fim_prefix|>package commands
import (
"fmt"
"github.com/konoui/lipo/pkg/lipo"
"github.com/wailsapp/wails/v3/internal/flags"
)
func ToolLipo(options *flags.Lipo) error {
DisableFooter = true
if len(options.Inputs) < 2 {
return fmt.Errorf("lipo requires ... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
// "github.com/wailsapp/wails/v3/internal/commands/dmg" // TODO: Missing package
"github.com/wailsapp/wails/v3/internal/flags"
"github.com/wailsapp/wails/v3/internal/packager"
)
// ToolPackage generates a package in the sp... | fim | wailsapp/wails | go |
<|fim_suffix|>}
},
wantErr: false,
},
{
name: "should handle case-insensitive format (ARCHLINUX)",
setup: func() (*flags.ToolPackage, func()) {
// Create a temporary config file
dir := t.TempDir()
configPath := filepath.Join(dir, "config.yaml")
err := os.WriteFile(configPath, []byte("nam... | fim | wailsapp/wails | go |
<|fim_suffix|>lease specify one of -major, -minor, -patch, or -prerelease")
}
// Bump the version based on the flags (major takes precedence over minor, which takes precedence over patch)
if options.Major {
major++
minor = 0
patch = 0
} else if options.Minor {
minor++
patch = 0
} else if options.Patch {... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"bytes"
"io"
"os"
"strings"
"testing"
)
func TestToolVersion(t *testing.T) {
// Create a table of test cases
testCases := []struct {
name string
options ToolVersionOptions
expectedOutput string
expectedError bool
}{
{
name: "Bump major ver... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"github.com/pterm/pterm"
"github.com/wailsapp/wails/v3/internal/debug"
"github.com/wailsapp/wails/v3/internal/github"
"github.com/wailsapp/wails/v3/internal/term"
"github.com/wailsapp/wails/v3/internal/version"
)
type UpdateCLIOpti... | fim | wailsapp/wails | go |
<|fim_suffix|>on.String())
return nil
}
<|fim_prefix|>package commands
import (
"github.com/wailsapp/wails/v3/internal/version"
)
type VersionOptions struct{}
func Version(_ *VersionOpt<|fim_middle|>ions) error {
DisableFooter = true
println(versi<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"fmt"
"io"
"os"
"github.com/wailsapp/wails/v3/internal/report"
)
// underWake reports whether this process was spawned by a wake build. When true,
// long-running producers (the bindings generator) should emit structured wire
// events for the build UI instead of drawing t... | fim | wailsapp/wails | go |
<|fim_suffix|>WatcherOptions struct {
Config string `description:"The config file including path" default:"."`
}
func Watcher(options *WatcherOptions) error {
stopChan := make(chan struct{})
// Parse the config file
type devConfig struct {
Config engine.Config `yaml:"dev_mode"`
}
var devconfig devConfig
//... | fim | wailsapp/wails | go |
<|fim_prefix|>package commands
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestEnsureIgnored(t *testing.T) {
t.Run("adds pattern when not present", func(t *testing.T) {
list := []string{".gitignore", ".DS_Store"}
ensureIgnored(<|fim_suffix|>ert.Len(t, list, 3)
})
t.Run("does not duplicat... | fim | wailsapp/wails | go |
<|fim_suffix|>
<|fim_prefix|>package dbus
//go:generate dbus-codegen-go -prefix org.kde -package notifier -output notifier/sta<|fim_middle|>tus_notifier_item.go StatusNotifierItem.xml
//go:generate dbus-codegen-go -prefix com.canonical -package menu -output menu/dbus_menu.go DbusMenu.xml<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>// Code generated by dbus-codegen-go DO NOT EDIT.
package menu
import (
"context"
"errors"
"fmt"
"github.com/godbus/dbus/v5"
"github.com/godbus/dbus/v5/introspect"
)
var (
// Introspection for com.canonical.dbusmenu
IntrospectDataDbusmenu = introspect.Interface{
Name: "com.canonical.dbusmenu",
... | fim | wailsapp/wails | go |
<|fim_prefix|>// Code generated by dbus-codegen-go DO NOT EDIT.
package notifier
import (
"context"
"errors"
"fmt"
"github.com/godbus/dbus/v5"
"github.com/godbus/dbus/v5/introspect"
)
var (
// Introspection for org.kde.StatusNotifierItem
IntrospectDataStatusNotifierItem = introspect.Interface{
Name: "org.kde... | fim | wailsapp/wails | go |
<|fim_suffix|>tex
after time.Duration
timer *time.Timer
generation uint64
}
func (d *debouncer) add(f func()) {
d.mu.Lock()
defer d.mu.Unlock()
if d.timer != nil {
d.timer.Stop()
}
d.generation++
gen := d.generation
d.timer = time.AfterFunc(d.after, func() {
d.mu.Lock()
if d.generation != gen... | fim | wailsapp/wails | go |
<|fim_suffix|>t64(&count); got != 1 {
t.Errorf("expected 1 call, got %d", got)
}
}
<|fim_prefix|>package debounce
import (
"sync/atomic"
"testing"
"time"
)
const (
// debounceAfter must be well above OS timer granularity (~15ms on Windows).
debounceAfter = 100 * time.Millisecond
// waitFor must exceed deboun... | fim | wailsapp/wails | go |
<|fim_prefix|>package debug
import (
"os"
"path/filepath"
"runtime"
)
var LocalModulePat<|fim_suffix|>irectory from here: ../../..
// If it does, we are in a local build
gitDir := RelativePath("..", "..", "..", ".git")
if _, err := os.Stat(gitDir); err == nil {
modulePath := RelativePath("..", "..", "..")
L... | fim | wailsapp/wails | go |
<|fim_suffix|> used when creating new projects
type GlobalDefaults struct {
// Author information
Author AuthorDefaults `json:"author" yaml:"author"`
// Default project settings
Project ProjectDefaults `json:"project" yaml:"project"`
}
// AuthorDefaults contains the author's information
type AuthorDefaults struct... | fim | wailsapp/wails | go |
<|fim_suffix|>ck for .syso file",
Run: func() (bool, string) {
// Check for .syso files in current directory
matches, err := filepath.Glob("*.syso")
if err != nil {
return false, "Error checking for .syso files"
}
if len(matches) > 0 {
return false, fmt.Sprintf("Found .syso file(s): %v.... | fim | wailsapp/wails | go |
<|fim_suffix|>n},
{"Go Version", runtime.Version()},
}
if buildInfo, _ := debug.ReadBuildInfo(); buildInfo != nil {
buildSettingToName := map[string]string{
"vcs.revision": "Revision",
"vcs.modified": "Modified",
}
for _, buildSetting := range buildInfo.Settings {
name := buildSettingToName[buildSet... | fim | wailsapp/wails | go |
<|fim_prefix|>package doctor
import (
"bytes"
"os"
"os/exec"
"path/filepath"
"runtime"
"sort"
"strconv"
"strings"
)
func checkCommonDependencies(result map[string]string, ok *bool) {
// Check for npm
npmVersion := []byte("Not Installed. Requires npm >= 7.0.0")
npmVersion, err := exec.Command("npm", "-v").O... | fim | wailsapp/wails | go |
<|fim_prefix|>//go:build darwin
package doctor
import (
"bytes"
"github.com/wailsapp/wails/v3/internal/lo"
"os/exec"
"strings"
"syscall"
)
func getSysctl(name string) string {
value, err := syscall.Sysctl(name)
if err != nil {
return "unknown"
}
return value
}
func getInfo() (map[string]string, bool) {
... | fim | wailsapp/wails | go |
<|fim_prefix|>//go:build linux
package doctor
import (
"os"
"strings"
"github.com/wailsapp/wails/v3/internal/doctor/packagemanager"
"github.com/wailsapp/wails/v3/internal/operatingsystem"
)
func getInfo() (map[string]string, bool) {
result := make(map[string]string)
// Check session type (X11/Wayland)
resul... | fim | wailsapp/wails | go |
<|fim_prefix|>package doctor
import "testing"
func TestRun(t *test<|fim_suffix|>un failed: %v", err)
}
}
<|fim_middle|>ing.T) {
err := Run()
if err != nil {
t.Errorf("TestR<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>//go:build windows
package doctor
import (
"os/exec"
"strings"
"github.com/wailsapp/wails/v3/internal/lo"
"github.com/wailsapp/wails/webview2/webviewloader"
)
func getInfo() (map[string]string, bool) {
ok := true
result := make(map[string]string)
result["Go WebView2Loader"] = lo.Ternary(webview... | fim | wailsapp/wails | go |
<|fim_prefix|>//go:build linux
package packagemanager
import (
"regexp"
"strings"
)
// Apt represents the Apt manager
type Apt struct {
name string
osid string
}
// NewApt creates a new Apt instance
func NewApt(osid string) *Apt {
return &Apt{
name: "apt",
osid: osid,
}
}
// Packages returns the librarie... | fim | wailsapp/wails | go |
//go:build linux
package packagemanager
import (
"os/exec"
"strings"
)
// Dnf represents the Dnf manager
type Dnf struct {
name string
osid string
}
// NewDnf creates a new Dnf instance
func NewDnf(osid string) *Dnf {
return &Dnf{
name: "dnf",
osid: osid,
}
}
// Packages returns the libraries that we nee... | fim | wailsapp/wails | go |
<|fim_suffix|>
installedRegex := regexp.MustCompile(`.*\*\s+` + regexp.QuoteMeta(pkg.Name) + `\n(?:\S|\s)+?Latest version available: (.*)`)
matches := installedRegex.FindStringSubmatch(stdout)
pkg.Version = ""
noOfMatches := len(matches)
available := false
if noOfMatches > 1 {
available = true
pkg.Version = s... | fim | wailsapp/wails | go |
<|fim_suffix|>rsion:\s+(.*)+, release: (.*)`)
matches := versionRegex.FindStringSubmatch(output)
pkg.Version = ""
noOfMatches := len(matches)
if noOfMatches > 1 {
pkg.Version = matches[1]
if noOfMatches > 2 {
pkg.Version += " (r" + matches[2] + ")"
}
}
}
<|fim_prefix|>//go:build linux
package packagemana... | fim | wailsapp/wails | go |
<|fim_prefix|>//go:build linux
package packagemanager
import (
"encoding/json"
)
// Nixpkgs represents the Nixpkgs manager
type Nixpkgs struct {
name string
osid string
}
type NixPackageDetail struct {
Name string
Pname string
Version string
}
var available map[string]NixPackageDetail
// NewNixpkgs cre... | fim | wailsapp/wails | go |
<|fim_suffix|>e manager commands
var pmcommands = []string{
"eopkg",
"apt",
"dnf",
"pacman",
"emerge",
"zypper",
"nix-env",
"xbps-install",
}
// commandExists returns true if the given command can be found on the shell
func commandExists(name string) bool {
_, err := exec.LookPath(name)
if err != nil {
ret... | fim | wailsapp/wails | go |
<|fim_prefix|>//go:build linux
package packagemanager
import (
"os/exec"
"regexp"
"strings"
)
// Pacman represents the Pacman package manager
type Pacman struct {
name string
o<|fim_suffix|>acman",
osid: osid,
}
}
// Packages returns the libraries that we need for Wails to compile
// They will potentially d... | fim | wailsapp/wails | go |
<|fim_suffix|>r _, dependency := range d {
if !dependency.Installed && dependency.Optional {
result += " - " + dependency.Name + ": " + dependency.InstallCommand + "\n"
}
}
return result
}
<|fim_prefix|>//go:build linux
package packagemanager
// Package contains information about a system package
type Pack... | fim | wailsapp/wails | go |
<|fim_suffix|>}
}
return false, nil
}
// InstallCommand returns the package manager specific command to install a package
func (x *Xbps) InstallCommand(pkg *Package) string {
if !pkg.SystemPackage {
return pkg.InstallCommand
}
return "sudo xbps-install -Sy " + pkg.Name
}
func (x *Xbps) getPackageVersion(pkg ... | fim | wailsapp/wails | go |
<|fim_prefix|>//go:build linux
// +build linux
package packagemanager
import (
"os/exec"
"regexp"
"strings"
)
// Zypper represents the Zypper package manager
type Zypper struct {
name string
osid string
}
// Ne<|fim_suffix|> given package is available for installation
func (z *Zypper) PackageAvailable(pkg *Pac... | fim | wailsapp/wails | go |
<|fim_suffix|>ader) (*DesktopEntry, error) {
scanner := bufio.NewScanner(r)
entry := &DesktopEntry{}
inDesktopEntry := false
for scanner.Scan() {
line := scanner.Text()
// Skip empty lines
if len(line) == 0 {
continue
}
// Skip comments (# at start of line)
if line[0] == '#' {
continue
}
... | fim | wailsapp/wails | go |
<|fim_prefix|>package fileexplorer
import (
"strings"
"testing"
)
func TestParseDesktopReader(t *testing.T) {
tests := []struct {
name string
input string
wantExec string
wantErr bool
}{
{
name: "simple desktop file",
input: `[Desktop Entry]
Name=Files
Exec=nautilus %U
Icon=org.gnome.Nauti... | fim | wailsapp/wails | go |
<|fim_prefix|>package fileexplorer
import (
"context"
"errors"
"fmt"
"os"
"os/exec"
"path/filepath"
"runtime<|fim_suffix|>me.GOOS {
case "windows":
// NOTE: Disabling the exit code check on Windows system. Workaround for explorer.exe
// exit code handling (https://github.com/microsoft/WSL/issues/6565)
ig... | fim | wailsapp/wails | go |
<|fim_suffix|>ocAttr {
return &syscall.SysProcAttr{}
}
<|fim_prefix|>//go:build darwin
package fileexplorer
import "syscall"
func explorerBinArgs(path string, selectFile bool) (string, []string, error) {
args := []string{}
if selectFile {
args = append(args, "-R")
}
args = append(args, path)
return "open", ... | fim | wailsapp/wails | go |
<|fim_suffix|>c pathToURI(path string) string {
absPath, err := filepath.Abs(path)
if err != nil {
return path
}
// Use url.URL to properly construct file URIs.
// url.PathEscape incorrectly escapes forward slashes (/ -> %2F),
// which breaks file manager path parsing.
u := &url.URL{
Scheme: "file",
Path: ... | fim | wailsapp/wails | go |
<|fim_prefix|>package fileexplorer_test
import (
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
"github.com/wailsapp/wails/v3/internal/fileexplorer"
)
// Credit: https://stackoverflow.com/a/50631395
func skipCI(t *testing.T) {
if os.Getenv("CI") != "" {
t.Skip("Skipping testing in CI environment"... | fim | wailsapp/wails | go |
<|fim_suffix|>sProcAttr{
CmdLine: fmt.Sprintf("explorer.exe \"%s\"", path),
}
}
}
<|fim_prefix|>//<|fim_middle|>go:build windows
package fileexplorer
import (
"fmt"
"syscall"
)
func explorerBinArgs(path string, selectFile bool) (string, []string, error) {
return "explorer.exe", []string{}, nil
}
func sysPr... | fim | wailsapp/wails | go |
<|fim_suffix|>NonWhitespace); start >= 0; start = strings.IndexFunc(str, isNonWhitespace) {
// each iteration starts at the beginning of a flag
// skip initial whitespace
str = str[start:]
// iterate over all quoted and unquoted parts of the flag and join them
for {
breakpoint := strings.IndexFunc(str, is... | fim | wailsapp/wails | go |
<|fim_suffix|>tt.wantFlags, gotFlags); diff != "" {
t.Errorf("BuildFlags() unexpected result: %s\n", diff)
}
if diff := cmp.Diff(wantErr, gotErr, cmpopts.EquateErrors()); diff != "" {
t.Errorf("BuildFlags() unexpected error: %s\n", diff)
}
})
}
}
<|fim_prefix|>package flags
import (
"testing"
"... | fim | wailsapp/wails | go |
<|fim_suffix|>isable colour in output"`
}
<|fim_prefix|>package flag<|fim_middle|>s
type Common struct {
NoColour bool `description:"D<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>package flags
type Init struct {
Common
PackageName string `name:"p" description:"Package name" default:"main"`
TemplateName string `name:"t" description:"Name of built-in template to use, path to template or template url" default:"vanilla"`
ProjectName string `name:"n" descripti... | fim | wailsapp/wails | go |
<|fim_prefix|>package flags
// Lipo represents the<|fim_suffix|>:"o" description:"Output path for the universal binary" default:""`
// Inputs are the architecture-specific binaries to combine
Inputs []string `name:"input" short:"i" description:"Input binaries to combine (specify multiple times)" default:""`
}
<|fim... | fim | wailsapp/wails | go |
<|fim_suffix|>msix-tool" description:"Use the Microsoft MSIX Packaging Tool for packaging" default:"false"`
UseMakeAppx bool `name:"use-makeappx" description:"Use MakeAppx.exe for packaging" default:"true"`
}
<|fim_prefix|>package flags
// <|fim_middle|>ToolMSIX represents the options for the MSIX packaging c... | fim | wailsapp/wails | go |
<|fim_prefix|>package flags
// ToolPackage represents the options for the package command
type ToolPackage struct {
Common<|fim_suffix|>ing `name:"config" description:"Path to the package configuration file" default:""`
Out string `name:"out" description:"Path to the output dir" default:"."`
BackgroundIm... | fim | wailsapp/wails | go |
<|fim_prefix|>package flags
type ServiceInit struct {
Name string `name:"n" description:"Name of service" default:"example_service"`
Description string `name:"d" description:"Description of service" default:"Example service"`
PackageName string `name:"p" description:"Package name for service" default:""`
Ou... | fim | wailsapp/wails | go |
package flags
// Sign contains flags for the sign command
type Sign struct {
Input string `name:"input" description:"Path to the file to sign"`
Output string `name:"output" description:"Output path (optional, defaults to in-place signing)"`
Verbose bool `name:"verbose" description:"Enable verbose o... | fim | wailsapp/wails | go |
<|fim_prefix|>package flags
type SigningSetup struct {
Platforms []string `name:"platform" description:"Platform(s) to configure (darwin, windows, linux). If not specified, auto-detects from build directory."`
}
type EntitlementsSetup struct {
O<|fim_suffix|>ut string `name:"output" description:"Output path for ent... | fim | wailsapp/wails | go |
<|fim_suffix|>stable obfuscated binding IDs"`
GarbleArgs string `name:"garbleargs" description:"Additional arguments to pass to garble before the build command"`
}
type Dev struct {
Common
}
type Package struct {
Common
}
type SignWrapper struct {
Common
}
<|fim_prefix|>package flags
type Build struct {
Common... | fim | wailsapp/wails | go |
<|fim_suffix|>*types.Func)
if !ok {
return nil, nil, ErrBadApplicationPackage
}
signature := fn.Type().(*types.Signature)
if signature.Params().Len() != 1 || signature.Results().Len() != 0 || signature.TypeParams().Len() != 1 {
logger.Warningf("application.RegisterService params: %d, results:... | fim | wailsapp/wails | go |
<|fim_prefix|>package generator
import (
"encoding/json"
"errors"
"go/types"
"os"
"path"
"path/filepath"
"slices"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/pterm/pterm"
"github.com/wailsapp/wails/v3/internal/generator/config"
)
func TestAnalyser(t *testing.T) {
type testParams struct {
name ... | fim | wailsapp/wails | go |
<|fim_suffix|>ageName == "" {
return nil, errors.New("empty package name for obfuscated bindings file")
}
aliases := buildPackageAliases(registrations, selfPkgPath)
var buf bytes.Buffer
writeMetadataHeader(&buf, packageName)
writeMetadataImports(&buf, aliases)
writeMetadataInit(&buf, registrations, aliases, s... | fim | wailsapp/wails | go |
<|fim_suffix|> t.Fatalf("bindingIDMetadataSource: %v", err)
}
source := string(got)
// Two aliases must appear, one suffixed.
if !strings.Contains(source, `profiles "example.com/app/a/profiles"`) {
t.Errorf("missing first alias\n%s", source)
}
if !strings.Contains(source, `profiles2 "example.com/app/b/profiles... | fim | wailsapp/wails | go |
// This example explores exhaustively the behaviour of encoding/json
// when handling types that implement marshaler interfaces.
//
// When encoding values, encoding/json makes no distinction
// between pointer and base types:
// if the base type implements a marshaler interface,
// be it with plain receiver or pointer... | fim | wailsapp/wails | go |
<|fim_prefix|>package collect
import (
"go/ast"
"go/types"
"sync"
"sync/atomic"
"github.com/wailsapp/wails/v3/internal/flags"
"github.com/wailsapp/wails/v3/internal/generator/config"
"golang.org/x/tools/go/packages"
)
// Scheduler instances provide task scheduling
// for collection activities.
type Scheduler ... | fim | wailsapp/wails | go |
<|fim_suffix|>le
info.Spec = collector.fromCache(path[0]).(*GroupInfo).Collect()
info.Decl = collector.fromCache(path[1]).(*GroupInfo).Collect()
info.node = path[0]
})
return info
}
<|fim_prefix|>package collect
import (
"go/ast"
"go/constant"
"go/token"
"go/types"
"sync"
)
// ConstInfo records informat... | fim | wailsapp/wails | go |
package collect
import (
"cmp"
"go/ast"
"go/token"
"go/types"
"slices"
)
// findDeclaration returns the AST spec or declaration
// that defines the given _global_ type-checker object.
//
// Specifically, the first element in the returned slice
// is the relevant spec or declaration, followed by its chain
// of p... | fim | wailsapp/wails | go |
<|fim_prefix|>package collect<|fim_suffix|>ve of the form //wails: + directive.
func IsDirective(comment string, directive string) bool {
if strings.HasPrefix(comment, "//wails:"+directive) {
length := len("//wails:") + len(directive)
if len(comment) == length {
return true
}
next, _ := utf8.DecodeRuneInSt... | fim | wailsapp/wails | go |
<|fim_suffix|>or: it is recommended to invoke `application.RegisterEvent` with constant arguments only")
continue
}
event := &EventInfo{
Data: inst.TypeArgs.At(0),
Pos: pkg.Fset.Position(call.Pos()),
}
if eventName.Value.Kind() == constant.String {
event.Name = constant.StringVal(eventName.Value)
... | fim | wailsapp/wails | go |
<|fim_prefix|>package collect
import (
"go/ast"
"go/token"
"go/types"
"sync"
)
// FieldInfo records information about a struct field declaration.
//
// Read accesses to any public field are only safe
// if a call to [FieldInfo.Collect] has completed before the access,
// for example by calling it in the accessing... | fim | wailsapp/wails | go |
<|fim_suffix|>*ast.Field:
info.Pos = n.Pos()
info.Doc = n.Doc
if info.Doc == nil {
info.Doc = n.Comment
} else if n.Comment != nil {
info.Doc = &ast.CommentGroup{
List: slices.Concat(n.Doc.List, n.Comment.List),
}
}
}
})
return info
}
<|fim_prefix|>package collect
import (
"go/ast... | fim | wailsapp/wails | go |
<|fim_prefix|>package collect
import (
"go/types"
"path/filepath"
)
type (
// ImportMap records deduplicated imports by a binding or models module.
// It computes relative import paths and assigns import names,
// taking care to avoid collisions.
ImportMap struct {
// Self records the path of the importing pa... | fim | wailsapp/wails | go |
<|fim_prefix|>package collect
import (
"slices"
"strings"
)
// PackageIndex lists all services, models and unexported models
// to be generated from a single package.
//
// When obtained through a call to [PackageInfo.Index],
// each service and model appears at most once;
// services and models are sorted
// by in... | fim | wailsapp/wails | go |
<|fim_prefix|>package collect
func IsKnownEvent(name string) bool {
_, ok := knownEvents[name]
return ok
}
var knownEvents = map[string]struct{}{
"common:ApplicationOpenedWithFile": {},
"common:ApplicationStarted": {},
"common:ApplicationLaunchedWithUr... | fim | wailsapp/wails | go |
<|fim_prefix|>package collect
import (
"go/ast"
"go/types"
"sync"
)
// MethodInfo records information about a method declaration.
//
// Read accesses to any public field are only safe
// if a call to [MethodInfo.Collect] has completed before the access,
// for example by calling it in the accessing goroutine
// or... | fim | wailsapp/wails | go |
<|fim_prefix|>package collect
import (
"cmp"
"go/ast"
"go/constant"
"go/types"
"slices"
"strings"
"sync"
)
type (
// ModelInfo records all information that is required
// to render JS/TS code for a model type.
//
// Read accesses to exported fields are only safe
// if a call to [ModelInfo.Collect] has com... | fim | wailsapp/wails | go |
<|fim_suffix|>rns false,
// Iterate stops the iteration.
//
// Iterate is safe for concurrent use.
func (collector *Collector) Iterate(yield func(pkg *PackageInfo) bool) {
for _, pkg := range collector.pkgs {
if !yield(pkg) {
return
}
}
}
// Stats returns cached statistics for this package.
// If [PackageInfo... | fim | wailsapp/wails | go |
<|fim_prefix|>package collect
// This file gathers functions that test useful properties of model types.
// The rationale for the way things are handled here
// is given in the example file found at ./_reference/json_marshaler_behaviour.go
import (
"go/token"
"go/types"
"iter"
"golang.org/x/exp/typeparams"
)
//... | fim | wailsapp/wails | go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.