Skip to content

chore(cli): split main.go by command group - #248

Merged
ryanlewis merged 1 commit into
mainfrom
chore/issue-242-split-main
Sep 10, 2026
Merged

ryanlewis merged 1 commit into
mainfrom
chore/issue-242-split-main

Conversation

@ryanlewis

Copy link
Copy Markdown
Owner

Closes #242

main.go was 1277 lines holding 22 of the 25 Kong commands. Split by
command group, matching the file-per-group convention already used by
config.go, tags.go, and completions.go. Also folded the ListCmd/SearchCmd
print asymmetry into one path: SearchCmd now calls PrintTaskList with an
empty view label instead of Print, producing byte-identical output.

No behaviour change. make test, make lint, make fmt all pass.

File map (old line range in main.go -> new file)

  • resolveTask (1116-1178), cacheTaskUUIDs (1269-1277) -> lookup.go
    (shared by Show, Edit, ProjectEdit, Complete, Cancel, Open)
  • ListCmd, applyDateFilters, ProjectsCmd, AreasCmd, TagsCmd,
    ShowCmd, SearchCmd (172-369, 667-687) -> list.go
  • AddCmd (371-403) -> add.go
  • ImportCmd, validateImportJSON, offsetToLineCol (807-857,
    1222-1260) -> import.go (pairs with the existing importcheck.go)
  • ProjectCmd, ProjectAddCmd, ProjectEditCmd (405-517) -> project.go
  • EditCmd, CompleteCmd, CancelCmd (519-665) -> edit.go
  • OpenCmd (859-933) -> open.go
  • SkillCmd subtree, resolveSkillDir (695-805, 1262-1267) -> skill.go
  • confirmProjectStatusChange, confirmAction (1186-1215) -> confirm.go
    (joins the existing ConfirmFlags)
  • main(), CLI, Deps, VersionCmd, LogCmd, and the kong/json
    plumbing stay in main.go, now 350 lines.

run_test.go drives commands through Kong rather than the binary, so
none of the moves touch it.

main.go held 22 of 25 Kong commands in 1277 lines. Split each command
group into its own file, matching the convention config.go/tags.go/
completions.go already used. Also fold SearchCmd's output.Print call
into PrintTaskList (with an empty view label), so it shares ListCmd's
print-then-hint path instead of diverging from it.

No logic change; output is byte-identical for every command.
@ryanlewis
ryanlewis force-pushed the chore/issue-242-split-main branch from b0a6af4 to 8337c74 Compare September 10, 2026 13:49
@ryanlewis
ryanlewis merged commit 29f796c into main Sep 10, 2026
8 checks passed
@ryanlewis
ryanlewis deleted the chore/issue-242-split-main branch September 10, 2026 13:51
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.

chore(cli): split cmd/things/main.go by command group

1 participant