Skip to content

fix: [v3] wails3 generate icons - default variable values#5753

Open
taliesin-ai wants to merge 1 commit into
wailsapp:masterfrom
taliesin-ai:dryw-fix-5699
Open

fix: [v3] wails3 generate icons - default variable values#5753
taliesin-ai wants to merge 1 commit into
wailsapp:masterfrom
taliesin-ai:dryw-fix-5699

Conversation

@taliesin-ai

@taliesin-ai taliesin-ai commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add default values for the -windowsfilename, -macfilename, and -input flags in the generate icons command. When no arguments are provided, default to: input='build/appicon.png', windowsfilename='build/windows/icon.ico', macfilename='build/darwin/icon.icns'. Update the command help text and documentation to reflect these defaults.

Changes

  • v3/pkg/w32/icon.go
  • v3/pkg/icons/icons.go
  • v3/internal/commands/icons.go
  • v3/cmd/wails3/main.go

Test Results

Closes #5699

Generated by dryw agent.

Summary by CodeRabbit

  • New Features

    • The icon generation command now supports flags and sensible default input/output paths for Windows and macOS icons.
    • The task command’s usage handling was updated for more consistent CLI behavior.
  • Bug Fixes

    • Improved command wiring and default settings to make icon generation easier to run without extra arguments.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The generate icons CLI subcommand was converted from a direct function call into a flag-driven subcommand using flags.GenerateIconsOptions, with default input/output icon paths added. IconsOptions struct fields gained matching default tags. Minor formatting touches occur in unrelated files.

Changes

Generate Icons Defaults

Layer / File(s) Summary
IconsOptions default tags
v3/internal/commands/icons.go
Input, WindowsFilename, and MacFilename fields gain default struct tags (build/appicon.png, build/windows/icon.ico, build/darwin/icon.icns); minor formatting at end of GenerateTemplateIcon.
CLI wiring for generate icons and task
v3/cmd/wails3/main.go
task subcommand action now uses Task.OtherArgs(); generate icons subcommand rebuilt to use flags.GenerateIconsOptions, default paths, AddFlags, and an Action calling commands.GenerateIcons.
Unrelated formatting touches
v3/pkg/icons/icons.go, v3/pkg/w32/icon.go
Non-functional end-of-file formatting changes with no logic impact.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • wailsapp/wails#4125: Both PRs address consistency of the generated Windows icon output path/filename toward windows/icon.ico.
  • wailsapp/wails#4219: Directly aligns with the WindowsFilename default change from icons.ico to icon.ico.
  • wailsapp/wails#5627: Related updates to icon generation output and its default paths.

Suggested labels: Bug, go, v3

Suggested reviewers: leaanthony

Poem

A rabbit hopped through icon trees,
Setting defaults with practiced ease—
No more guessing "where's my file?",
Just wails3 generate icons, in style!
🐇🖼️✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes a summary and issue link, but it omits required template sections like type, testing details, test config, and checklist. Add the template sections for type of change, testing, wails doctor/test configuration, checklist items, and any dependencies.
Out of Scope Changes check ⚠️ Warning The re-touch of v3/pkg/icons/icons.go and v3/pkg/w32/icon.go appears unrelated to the issue and adds no functional change. Drop the unrelated line-ending and brace-only edits, and keep the PR limited to the generate-icons default-value changes.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: default values for wails3 generate icons.
Linked Issues check ✅ Passed The PR implements the requested default input and output icon paths and updates the command help text for #5699.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@v3/cmd/wails3/main.go`:
- Around line 73-81: The icons subcommand is binding to a non-existent flags
type, so switch the `icons` setup in `main` to use `commands.IconsOptions`
directly instead of `flags.GenerateIconsOptions`. Keep the `icons.AddFlags` and
`icons.Action` wiring, but make sure the command reads from the
`commands.IconsOptions` struct so it compiles. Also remove the duplicated
hardcoded default values in this setup and rely on the `default:` tags on
`IconsOptions` as the single source of truth.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4c620019-03c7-455b-a3ae-295d1ebf5999

📥 Commits

Reviewing files that changed from the base of the PR and between 1961c27 and bb61a0a.

📒 Files selected for processing (4)
  • v3/cmd/wails3/main.go
  • v3/internal/commands/icons.go
  • v3/pkg/icons/icons.go
  • v3/pkg/w32/icon.go

Comment thread v3/cmd/wails3/main.go
Comment on lines +73 to +81
icons := generate.NewSubCommand("icons", "Generate icons")
var iconsFlags flags.GenerateIconsOptions
iconsFlags.Input = "build/appicon.png"
iconsFlags.WindowsFilename = "build/windows/icon.ico"
iconsFlags.MacFilename = "build/darwin/icon.icns"
icons.AddFlags(&iconsFlags)
icons.Action(func() error {
return commands.GenerateIcons(&iconsFlags)
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Confirm whether flags.GenerateIconsOptions exists and how it relates to commands.IconsOptions
fd -t f . v3/pkg/flags 2>/dev/null | xargs -r grep -n "GenerateIconsOptions" 
echo "---"
rg -n "type GenerateIconsOptions" v3/pkg/flags
echo "---"
rg -n "func GenerateIcons\(" v3/internal/commands
echo "---"
rg -n "type IconsOptions struct" -A 10 v3/internal/commands/icons.go

Repository: wailsapp/wails

Length of output: 1161


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the main file and related flag/command definitions
git ls-files 'v3/**' | sed -n '1,200p' | rg '^(v3/cmd/wails3/main.go|v3/.*/flags|v3/.*/commands/icons.go|v3/.*/icons.go)$'

echo "--- main.go ---"
sed -n '1,140p' v3/cmd/wails3/main.go

echo "--- files mentioning GenerateIconsOptions or IconsOptions ---"
rg -n "GenerateIconsOptions|IconsOptions|GenerateIcons\(" v3

echo "--- candidate flag definitions around the generate-icons area ---"
rg -n -A 12 -B 6 "GenerateIconsOptions|iconsFlags|GenerateIcons\(" v3/cmd v3/internal v3/pkg

Repository: wailsapp/wails

Length of output: 15703


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "--- internal/flags files ---"
git ls-files 'v3/internal/flags/*'

echo "--- GenerateIconsOptions definition ---"
sed -n '1,220p' v3/internal/flags/*.go | rg -n -A 20 -B 5 "type GenerateIconsOptions|type .*Icons|default:|description:"

echo "--- commands/icons.go struct and defaults ---"
sed -n '1,80p' v3/internal/commands/icons.go

echo "--- any alias to commands.IconsOptions ---"
rg -n "type GenerateIconsOptions\s*=" v3/internal/flags v3/internal

Repository: wailsapp/wails

Length of output: 5813


Use commands.IconsOptions here

v3/internal/flags doesn’t define GenerateIconsOptions, so var iconsFlags flags.GenerateIconsOptions won’t compile. Bind the subcommand directly to commands.IconsOptions (or add a real alias in v3/internal/flags). The hardcoded defaults here also duplicate the default: tags on commands.IconsOptions; keeping a single source of truth would avoid drift.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v3/cmd/wails3/main.go` around lines 73 - 81, The icons subcommand is binding
to a non-existent flags type, so switch the `icons` setup in `main` to use
`commands.IconsOptions` directly instead of `flags.GenerateIconsOptions`. Keep
the `icons.AddFlags` and `icons.Action` wiring, but make sure the command reads
from the `commands.IconsOptions` struct so it compiles. Also remove the
duplicated hardcoded default values in this setup and rely on the `default:`
tags on `IconsOptions` as the single source of truth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v3] wails3 generate icons - default variable values

1 participant