Skip to content

Inconsistent exit-code convention for invalid usage: git/gh modules return 1, list/str/arg/cli modules return 2 #287

Description

@codeforester

Summary

Most modules reserve exit code 2 for usage/validation errors and 1 for operational failures, but git/gh don't follow that convention.

Details

  • lib/bash/git/lib_git.sh (e.g. :14-17, :24-27, :55-58, :132-134) and lib/bash/gh/lib_gh.sh (e.g. :17-19, :269-272, :292-293) return 1 uniformly for both bad-usage errors and genuine operational failures (e.g. base_git_detect_default_branch returns 1 both for wrong arg count and for "couldn't detect a branch", lib_git.sh:51).
  • Contrast lib/bash/list/lib_list.sh:25-29, lib/bash/arg/lib_arg.sh:152-155, and lib/bash/cli/lib_cli.sh (__base_bash_libs_cli_declaration_usage__ etc.), which consistently return 2 for usage/validation errors.

Impact

A consumer can't reliably branch on exit status to distinguish "I called this wrong" from "the operation failed" when mixing git/gh helpers with list/str/arg/cli helpers.

Suggested fix

Adopt one convention repo-wide (2 = usage error, 1 = operational failure, matching most modules) and update git/gh accordingly, or explicitly document the deviation.

Metadata

Metadata

Assignees

Labels

bugSomething is not working

Type

No type

Projects

Status
Triage

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions