Skip to content

--select and --compact are inert on the hand-rolled renderers and say nothing #358

Description

@ktn-jamf

Summary

--select and --compact do nothing on the default output of the commands that render their own text. The flags are parsed and accepted. No error and no note says the flag had no effect.

CLAUDE.md states the rule this breaks, under Conventions: "a documented flag that does nothing is worse than an absent one, because the operator used it as documented", and "Every command that inherits -n either honours it or says in its Long what it does not cover."

Command run

jamf-cli pro overview --select summary

No -o flag, so a terminal resolves to table, which is these commands' default.

Expected behavior

Either the flag narrows the output, or --help says the flag does not apply to the default view.

Actual behavior

The full multi-section report prints. Nothing reports that --select had no effect. The same command with -o json --select ... does apply the projection, so behaviour changes with a flag the operator did not set.

Affected commands

pro overview, pro device, protect overview, school overview and doctor. Each hands a writer to a hand-rolled section renderer that never reaches Formatter.Print, so applyProjection never runs.

Why #349 did not fix it

#349 routed these commands' writer through writerFor, so --out-file now works for them. It did not change the renderer, so projection still does not apply. The state is unchanged from before #349 for these two flags.

The choice this needs

Projection on the overview row shape is not obviously useful. overviewToRows (internal/commands/pro_overview.go) emits section, resource, value and status, so --select can only name one of those four. An operator typing --select summary or --select computers names a field that does not exist in that vocabulary, and gets an empty table. So "route the table through printRows when --select is set" answers the letter and not the intent.

Two candidates:

  1. Say it in Long. One sentence per command, matching how the backup commands document the shorthand they lose. Cheap, and it satisfies the convention.
  2. Refuse the combination. Exit 2 with a message naming -o json as the route that supports projection.

Option 1 is the smaller change and matches the existing precedent in this repo.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions