cmd: resolve no-op --quiet/--verbose flags (#34) #39
No files matched your search
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Removed
|
||||
- Removed the no-op `--quiet`/`-q` and `--verbose`/`-v` persistent flags. They were bound but never read, so they advertised behavior they never delivered; the CLI has no non-essential output to suppress and no diagnostic stream to emit. Passing them now produces a usage error (exit 2).
|
||||
|
||||
## [0.3.0] - 2026-06-04
|
||||
|
||||
### Install
|
||||
|
||||
@@ -137,8 +137,6 @@ overwrite it unless `--force` is passed.
|
||||
--include <glob> restrict to matching paths (repeatable)
|
||||
--exclude <glob> skip matching paths (repeatable)
|
||||
--no-gitignore do not honor .gitignore during enumeration
|
||||
--quiet, -q suppress non-essential output
|
||||
--verbose, -v verbose output
|
||||
```
|
||||
|
||||
### Exit codes
|
||||
|
||||
@@ -30,8 +30,6 @@ type sharedFlags struct {
|
||||
include []string
|
||||
exclude []string
|
||||
noGitignore bool
|
||||
quiet bool
|
||||
verbose bool
|
||||
}
|
||||
|
||||
// newRootCmd assembles the full command tree. WHY a constructor that takes
|
||||
@@ -53,8 +51,6 @@ func newRootCmd(info buildInfo) *cobra.Command {
|
||||
pf.StringArrayVar(&shared.include, "include", nil, "glob of files to include (repeatable)")
|
||||
pf.StringArrayVar(&shared.exclude, "exclude", nil, "glob of files to exclude (repeatable)")
|
||||
pf.BoolVar(&shared.noGitignore, "no-gitignore", false, "do not inherit .gitignore on the non-git walk")
|
||||
pf.BoolVarP(&shared.quiet, "quiet", "q", false, "suppress non-essential output")
|
||||
pf.BoolVarP(&shared.verbose, "verbose", "v", false, "verbose diagnostic output")
|
||||
|
||||
root.AddCommand(
|
||||
newAuditCmd(shared),
|
||||
|
||||
@@ -159,9 +159,28 @@ func TestNewRootCmd(t *testing.T) {
|
||||
}
|
||||
|
||||
// Persistent flags are bound on the root.
|
||||
for _, f := range []string{"config", "include", "exclude", "no-gitignore", "quiet", "verbose"} {
|
||||
for _, f := range []string{"config", "include", "exclude", "no-gitignore"} {
|
||||
assert.NotNil(t, root.PersistentFlags().Lookup(f), "persistent flag %q", f)
|
||||
}
|
||||
|
||||
// The no-op --quiet/--verbose flags (and their -q/-v shorthands) were removed
|
||||
// in #34: the CLI had no non-essential output to gate and no diagnostic stream
|
||||
// to emit, so the flags advertised behavior they never delivered.
|
||||
for _, f := range []string{"quiet", "verbose"} {
|
||||
assert.Nil(t, root.PersistentFlags().Lookup(f), "removed persistent flag %q must not be registered", f)
|
||||
}
|
||||
}
|
||||
|
||||
func TestQuietVerboseFlagsRemoved(t *testing.T) {
|
||||
isolateEnv(t)
|
||||
dir := fixtureDir(t)
|
||||
for _, arg := range []string{"--quiet", "-q", "--verbose", "-v"} {
|
||||
t.Run(arg, func(t *testing.T) {
|
||||
_, stderr, code := executeRoot(t, "audit", arg, dir)
|
||||
assert.Equal(t, exitUsage, code, "removed flag %q should yield a usage error", arg)
|
||||
assert.Contains(t, stderr, "unknown")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestArgPath(t *testing.T) {
|
||||
|
||||
@@ -20,7 +20,7 @@ license-tool init [path] # Scaffold a .license-tool.yaml (interactive on a
|
||||
license-tool version # Version, commit, build date
|
||||
```
|
||||
|
||||
Shared flags: `--config <file>`, `--include <glob>` (repeatable), `--exclude <glob>` (repeatable), `--no-gitignore`, `--quiet|-q`, `--verbose|-v`.
|
||||
Shared flags: `--config <file>`, `--include <glob>` (repeatable), `--exclude <glob>` (repeatable), `--no-gitignore`.
|
||||
|
||||
`audit` / `check` flags: `--format text|json|markdown` (default `text`; `check` forces machine-friendly), `--output <file>`, `--deps|--no-deps` (default on), `--resolve-deps ondisk|tool|off` (default `ondisk`), `--fail-on <conditions>` (check only; default `missing-header,unknown-license,policy-violation`).
|
||||
|
||||
|
||||
Reference in new issue
Block a user