cmd/bsdaily/main.go is now a single call, os.Exit(cli.Main(Version)), as REPO_POLICIES.md asks of cmd/. Version stays in package main, where -X main.Version sets it.
The cobra command, the flag rules and the date parsing moved as they were into a new package, internal/cli: cli.go holds Main (logger setup, the command and its flags) and dates.go holds ParseTargetDates and its errors. Flags, help text, error messages, exit status and the first log line with the version are unchanged.
dates_test.go has two table tests of ParseTargetDates: one for accepted flags (none, a single date, a range across a month end, a range of one day) and one for rejected ones (--from after --to, either half of a range missing, --date with --from and with both, malformed and nonexistent dates). They never touch the filesystem or run the extraction.
The README (How It Works) now says which part lives where; TODO.md records the step and narrows Next Step to the internal/bsdaily tests.
Judgement call: parseTargetDates is exported as ParseTargetDates so the tests, in package cli_test, use only what the package exposes.
Judgement call: the fallback to dev for an empty version moved from main into cli.Main, so main holds only the one call.
Judgement call: for a malformed date the tests check how the message starts, not the date parser's own wording that follows it.
Unverified: the dev fallback was not run through a built binary; every build here carries a version.
Model: opus-5-5
`cmd/bsdaily/main.go` is now a single call, `os.Exit(cli.Main(Version))`, as `REPO_POLICIES.md` asks of `cmd/`. `Version` stays in package `main`, where `-X main.Version` sets it.
The cobra command, the flag rules and the date parsing moved as they were into a new package, `internal/cli`: `cli.go` holds `Main` (logger setup, the command and its flags) and `dates.go` holds `ParseTargetDates` and its errors. Flags, help text, error messages, exit status and the first log line with the version are unchanged.
`dates_test.go` has two table tests of `ParseTargetDates`: one for accepted flags (none, a single date, a range across a month end, a range of one day) and one for rejected ones (`--from` after `--to`, either half of a range missing, `--date` with `--from` and with both, malformed and nonexistent dates). They never touch the filesystem or run the extraction.
The README (How It Works) now says which part lives where; `TODO.md` records the step and narrows Next Step to the `internal/bsdaily` tests.
- Judgement call: `parseTargetDates` is exported as `ParseTargetDates` so the tests, in package `cli_test`, use only what the package exposes.
- Judgement call: the fallback to `dev` for an empty version moved from `main` into `cli.Main`, so `main` holds only the one call.
- Judgement call: for a malformed date the tests check how the message starts, not the date parser's own wording that follows it.
- Unverified: the `dev` fallback was not run through a built binary; every build here carries a version.
Model: opus-5-5
cmd/bsdaily/main.go now only passes Version to cli.Main and exits with
the status it returns, as REPO_POLICIES.md requires of cmd/. The cobra
command, the flag rules and the date parsing moved unchanged into
internal/cli, so flags, help text, error messages, exit status and the
first log line stay as they were. The fallback to dev for an empty
version moved with them into cli.Main.
parseTargetDates is exported as ParseTargetDates so that a table test
outside the package can reach it; the test never touches the filesystem
or runs the extraction. README describes the new layout and TODO.md
records the step.
Model: opus-5-5
internal/cli/dates_test.go line 104: every error case checks only how the message starts, including the four whose whole text is fixed (--from requires --to, --to requires --from, --date and --from/--to are mutually exclusive, --from … is after --to …). Text added to the end of any of these messages still passes, although #8 requires the error messages to stay as they are. Acceptable: compare those four messages in full, and keep the start-only match for the malformed-date cases, where the date parser's own wording follows.
internal/cli/dates_test.go, the error table (lines 66-97): --date together with --to alone has no case, so the rule that --date excludes --from/--to is tested only for --from. Acceptable: add a --date with --to case that expects the mutually-exclusive message.
TODO.md line 27: the new Completed Steps entry is followed by a blank line, the only one in that list. This makes the whole list loose, so every entry renders as its own paragraph. Acceptable: no blank line, like the other entries.
Model: opus-5-5
Review failed.
1. `internal/cli/dates_test.go` line 104: every error case checks only how the message starts, including the four whose whole text is fixed (`--from requires --to`, `--to requires --from`, `--date and --from/--to are mutually exclusive`, `--from … is after --to …`). Text added to the end of any of these messages still passes, although https://git.eeqj.de/sneak/bsdaily/issues/8 requires the error messages to stay as they are. Acceptable: compare those four messages in full, and keep the start-only match for the malformed-date cases, where the date parser's own wording follows.
2. `internal/cli/dates_test.go`, the error table (lines 66-97): `--date` together with `--to` alone has no case, so the rule that `--date` excludes `--from`/`--to` is tested only for `--from`. Acceptable: add a `--date` with `--to` case that expects the mutually-exclusive message.
3. `TODO.md` line 27: the new Completed Steps entry is followed by a blank line, the only one in that list. This makes the whole list loose, so every entry renders as its own paragraph. Acceptable: no blank line, like the other entries.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
cmd/bsdaily/main.gois now a single call,os.Exit(cli.Main(Version)), asREPO_POLICIES.mdasks ofcmd/.Versionstays in packagemain, where-X main.Versionsets it.The cobra command, the flag rules and the date parsing moved as they were into a new package,
internal/cli:cli.goholdsMain(logger setup, the command and its flags) anddates.goholdsParseTargetDatesand its errors. Flags, help text, error messages, exit status and the first log line with the version are unchanged.dates_test.gohas two table tests ofParseTargetDates: one for accepted flags (none, a single date, a range across a month end, a range of one day) and one for rejected ones (--fromafter--to, either half of a range missing,--datewith--fromand with both, malformed and nonexistent dates). They never touch the filesystem or run the extraction.The README (How It Works) now says which part lives where;
TODO.mdrecords the step and narrows Next Step to theinternal/bsdailytests.parseTargetDatesis exported asParseTargetDatesso the tests, in packagecli_test, use only what the package exposes.devfor an empty version moved frommainintocli.Main, somainholds only the one call.devfallback was not run through a built binary; every build here carries a version.Model: opus-5-5
Review failed.
internal/cli/dates_test.goline 104: every error case checks only how the message starts, including the four whose whole text is fixed (--from requires --to,--to requires --from,--date and --from/--to are mutually exclusive,--from … is after --to …). Text added to the end of any of these messages still passes, although #8 requires the error messages to stay as they are. Acceptable: compare those four messages in full, and keep the start-only match for the malformed-date cases, where the date parser's own wording follows.internal/cli/dates_test.go, the error table (lines 66-97):--datetogether with--toalone has no case, so the rule that--dateexcludes--from/--tois tested only for--from. Acceptable: add a--datewith--tocase that expects the mutually-exclusive message.TODO.mdline 27: the new Completed Steps entry is followed by a blank line, the only one in that list. This makes the whole list loose, so every entry renders as its own paragraph. Acceptable: no blank line, like the other entries.Model: opus-5-5
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.