style: apply gofmt formatting

This commit is contained in:
Willie
2026-03-17 04:48:42 +08:00
parent 26804547b3
commit 23e43fc976
16 changed files with 40 additions and 45 deletions
+1 -1
View File
@@ -377,7 +377,7 @@ func formatCategoryBreakdownTUI(cats map[string]int) string {
if cc.count > 50 {
parts[i] = tc.Emphasis.Bold(true).Render(label+":") + tc.Emphasis.Bold(true).Render(fmt.Sprintf("%d", cc.count))
} else {
parts[i] = tc.Dim.Render(label+":"+fmt.Sprintf("%d", cc.count))
parts[i] = tc.Dim.Render(label + ":" + fmt.Sprintf("%d", cc.count))
}
}
return strings.Join(parts, " ")
-1
View File
@@ -51,7 +51,6 @@ func (i auditItem) Title() string {
return tc.Yellow.Render("!") + " " + name
}
// compactAuditPath strips tracked repo prefix (first segment starting with "_")
// and keeps at most the last 2 segments.
func compactAuditPath(name string) string {
+2 -2
View File
@@ -508,9 +508,9 @@ func diffOutputJSON(results []targetDiffResult, start time.Time) error {
func diffOutputJSONWithExtras(results []targetDiffResult, extrasResults []extraDiffResult, start time.Time) error {
type outputWithExtras struct {
Targets []diffJSONTarget `json:"targets"`
Targets []diffJSONTarget `json:"targets"`
Extras []extraDiffJSONEntry `json:"extras,omitempty"`
Duration string `json:"duration"`
Duration string `json:"duration"`
}
o := outputWithExtras{
Duration: formatDuration(start),
-1
View File
@@ -140,7 +140,6 @@ func collectExtrasDiff(extras []config.ExtraConfig, sourceResolver func(string)
return results
}
// renderExtrasDiffPlain renders extras diff in plain text.
func renderExtrasDiffPlain(results []extraDiffResult) {
fmt.Println()
-1
View File
@@ -51,4 +51,3 @@ Options:
--global, -g Use global extras (~/.config/skillshare/)
--help, -h Show this help`)
}
-1
View File
@@ -219,4 +219,3 @@ Options:
--global, -g Use global extras (~/.config/skillshare/)
--help, -h Show this help`)
}
+1 -1
View File
@@ -21,7 +21,7 @@ func (i extraTUIItem) Description() string { return "" }
type extrasListDelegate struct{}
func (extrasListDelegate) Height() int { return 1 }
func (extrasListDelegate) Spacing() int { return 1 }
func (extrasListDelegate) Spacing() int { return 1 }
func (extrasListDelegate) Update(_ tea.Msg, _ *list.Model) tea.Cmd { return nil }
func (extrasListDelegate) Render(w io.Writer, m list.Model, index int, item list.Item) {
+5 -3
View File
@@ -47,7 +47,7 @@ func (g *globalInstallContext) Reconcile() error {
}
func (g *globalInstallContext) PostInstallSkill(string) error { return nil }
func (g *globalInstallContext) Mode() string { return "global" }
func (g *globalInstallContext) GitLabHosts() []string { return g.cfg.EffectiveGitLabHosts() }
func (g *globalInstallContext) GitLabHosts() []string { return g.cfg.EffectiveGitLabHosts() }
// ---------------------------------------------------------------------------
// projectInstallContext
@@ -71,5 +71,7 @@ func (p *projectInstallContext) PostInstallSkill(displayName string) error {
filepath.Join("skills", displayName),
)
}
func (p *projectInstallContext) Mode() string { return "project" }
func (p *projectInstallContext) GitLabHosts() []string { return p.runtime.config.EffectiveGitLabHosts() }
func (p *projectInstallContext) Mode() string { return "project" }
func (p *projectInstallContext) GitLabHosts() []string {
return p.runtime.config.EffectiveGitLabHosts()
}
+1 -1
View File
@@ -48,7 +48,7 @@ func writeJSONError(err error) error {
fmt.Fprintf(os.Stderr, "json marshal error: %v\n", merr)
fmt.Printf("{\"error\": %q}\n", err.Error())
} else {
os.Stdout.Write(out) //nolint:errcheck
os.Stdout.Write(out) //nolint:errcheck
os.Stdout.Write([]byte("\n")) //nolint:errcheck
}
return &jsonSilentError{cause: err}
+1 -1
View File
@@ -150,7 +150,7 @@ func printUsage() {
// Colors
y := "\033[33m" // yellow - commands
c := "\033[36m" // cyan - arguments
g := ui.Dim // dim
g := ui.Dim // dim
r := "\033[0m" // reset
// ASCII art logo
-1
View File
@@ -144,4 +144,3 @@ func formatRiskBadgeLipgloss(label string) string {
}
return " " + riskLabelStyle(label).Render("["+label+"]")
}
-1
View File
@@ -1150,7 +1150,6 @@ func logUninstallOp(cfgPath string, names []string, succeeded int, start time.Ti
oplog.WriteWithLimit(cfgPath, oplog.OpsFile, e, logMaxEntries()) //nolint:errcheck
}
func printUninstallHelp() {
fmt.Println(`Usage: skillshare uninstall <name>... [options]
skillshare uninstall --group <group> [options]
+8 -8
View File
@@ -59,14 +59,14 @@ type ExtraConfig struct {
// Config holds the application configuration
type Config struct {
Source string `yaml:"source"`
Mode string `yaml:"mode,omitempty"` // default mode: merge
Targets map[string]TargetConfig `yaml:"targets"`
Extras []ExtraConfig `yaml:"extras,omitempty"`
Ignore []string `yaml:"ignore,omitempty"`
Audit AuditConfig `yaml:"audit,omitempty"`
Hub HubConfig `yaml:"hub,omitempty"`
Log LogConfig `yaml:"log,omitempty"`
Source string `yaml:"source"`
Mode string `yaml:"mode,omitempty"` // default mode: merge
Targets map[string]TargetConfig `yaml:"targets"`
Extras []ExtraConfig `yaml:"extras,omitempty"`
Ignore []string `yaml:"ignore,omitempty"`
Audit AuditConfig `yaml:"audit,omitempty"`
Hub HubConfig `yaml:"hub,omitempty"`
Log LogConfig `yaml:"log,omitempty"`
TUI *bool `yaml:"tui,omitempty"` // nil = default true
GitLabHosts []string `yaml:"gitlab_hosts,omitempty"`
}
+3 -3
View File
@@ -382,9 +382,9 @@ func TestWrapGitError(t *testing.T) {
func TestExtractGitFatal(t *testing.T) {
tests := []struct {
name string
stderr string
want string
name string
stderr string
want string
}{
{
name: "fatal line only",
+11 -12
View File
@@ -310,13 +310,13 @@ func (s *Server) handleExtrasSync(w http.ResponseWriter, r *http.Request) {
extras := s.extrasConfig()
type targetSyncResult struct {
Target string `json:"target"`
Mode string `json:"mode"`
Synced int `json:"synced"`
Skipped int `json:"skipped"`
Pruned int `json:"pruned"`
Target string `json:"target"`
Mode string `json:"mode"`
Synced int `json:"synced"`
Skipped int `json:"skipped"`
Pruned int `json:"pruned"`
Errors []string `json:"errors,omitempty"`
Error string `json:"error,omitempty"`
Error string `json:"error,omitempty"`
}
type extraSyncResult struct {
Name string `json:"name"`
@@ -370,11 +370,11 @@ func (s *Server) handleExtrasSync(w http.ResponseWriter, r *http.Request) {
}
s.writeOpsLog("extras-sync", "ok", start, map[string]any{
"name": body.Name,
"dryRun": body.DryRun,
"force": body.Force,
"count": len(results),
"scope": "ui",
"name": body.Name,
"dryRun": body.DryRun,
"force": body.Force,
"count": len(results),
"scope": "ui",
}, "")
writeJSON(w, map[string]any{"results": results})
@@ -497,4 +497,3 @@ func (s *Server) handleExtrasDelete(w http.ResponseWriter, r *http.Request) {
writeJSON(w, map[string]any{"success": true, "name": name})
}
+7 -7
View File
@@ -344,18 +344,18 @@ type ProgressBar struct {
}
const (
barWidth = 36 // fixed visible width (character count)
barFill = "■" // U+25A0 filled block
barEmpty = "・" // U+FF65 half-width dot
barColor = "\033[0;36m" // reset + cyan (project accent)
barDim = "\033[36;2m" // cyan + dim for empty dots
barMuted = "\x1b[0;2m" // dim attribute for label + count
barWidth = 36 // fixed visible width (character count)
barFill = "■" // U+25A0 filled block
barEmpty = "・" // U+FF65 half-width dot
barColor = "\033[0;36m" // reset + cyan (project accent)
barDim = "\033[36;2m" // cyan + dim for empty dots
barMuted = "\x1b[0;2m" // dim attribute for label + count
barReset = Reset
hideCursor = "\x1b[?25l"
showCursor = "\x1b[?25h"
clearLine = "\r\x1b[2K"
barThrottleMs = 50 * time.Millisecond // min interval between renders
barFixedOverhead = barWidth + 8 // bar chars + " NNN% " + padding
barFixedOverhead = barWidth + 8 // bar chars + " NNN% " + padding
)
// StartProgress starts a progress bar with the given title and total count.