Skip to content

feat: add --json to alias ls, class ls, watch ls - #86

Merged
gsjonio merged 1 commit into
developfrom
feature/list-json
Jul 19, 2026
Merged

feat: add --json to alias ls, class ls, watch ls#86
gsjonio merged 1 commit into
developfrom
feature/list-json

Conversation

@gsjonio

@gsjonio gsjonio commented Jul 19, 2026

Copy link
Copy Markdown
Owner

What and why

The list commands (alias ls, class ls, watch ls) were text-only. This adds --json so they're scriptable, matching the rest of the read commands.

  • Each store serializes with a canonical string MAC (net.HardwareAddr marshals as raw bytes otherwise) and emits [] on an empty store, never null.
  • class ls --json uses the lowercase canonical token (e.g. "mobile"), so it round-trips straight back into netwp class set.
  • A shared newListCmd helper builds the three ls subcommands (same shape, one --json flag) instead of wiring the flag three times.

Closes #72

Risks

None. Additive read-only flags; the default text output is unchanged.

Checklist

  • Build, vet/lint, and tests pass
  • New non-trivial logic has a test (TestListJSONMappers: empty→[], MAC/class mapping)
  • Conventional Commits, no Claude co-author trailer
  • README.md and README.pt-BR.md updated in this PR
  • Issue has a milestone (v1.21.0)

The list commands were text-only. Add --json so nicknames, class pins, and the
watch list are scriptable, matching scan/events/etc. Each store serializes with
a canonical string MAC (net.HardwareAddr marshals as raw bytes otherwise) and
emits [] on an empty store, never null. class ls --json uses the lowercase
canonical token (e.g. "mobile"), so it round-trips back into class set.

A shared newListCmd builds the three ls subcommands (same shape, one --json
flag), so the flag isn't wired three times.

Closes #72
@gsjonio
gsjonio merged commit 81d2ddc into develop Jul 19, 2026
9 checks passed
@gsjonio
gsjonio deleted the feature/list-json branch July 19, 2026 03:13
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.

Add --json to the list commands (alias ls, class ls, watch ls)

1 participant