Skip to content

Return success when Didi shows command help - #8

Open
imshah-id wants to merge 1 commit into
phbpx:mainfrom
imshah-id:fix/help-exit-status
Open

imshah-id wants to merge 1 commit into
phbpx:mainfrom
imshah-id:fix/help-exit-status

Conversation

@imshah-id

Copy link
Copy Markdown

O que muda / What changes

Explicit help requests exit with status 0, including global help and subcommands that have no flags. The latter now print usage instead of performing the command. Invalid flags, unknown commands, and missing usage arguments still exit with status 2.

The Portuguese and English guides now document the help status, the default end date for portfolio sales, and the remaining history response fields.

Closes #6.

Por quê / Why

flag.ErrHelp printed usage but reached the same exit path as a parsing error. A few commands bypassed flag parsing, so -h either ran the query or printed the version.

Como foi verificado / How it was verified

  • gofmt -l . prints nothing
  • go vet ./...
  • go test ./...
  • TestHelpExitCode reproduced both failure modes before the fix and passes afterward
  • Both Portuguese and English guides updated
  • Tests use temporary directories and no B3, CVM, or personal data

go mod tidy -diff also passed. Local verification used Go 1.27.2 on darwin/arm64.

Codex assisted with implementation, testing and documentation.

Route flag.ErrHelp to exit code 0 and print usage for commands that do not parse flags. Bring the Portuguese and English API guides into line with the sales date default and history fields.
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.

Pontas soltas: código de saída da ajuda e dois detalhes do guia da API HTTP / Loose ends: help exit code and two HTTP API doc details

1 participant