feat: add --json to alias ls, class ls, watch ls - #86
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The list commands (
alias ls,class ls,watch ls) were text-only. This adds--jsonso they're scriptable, matching the rest of the read commands.net.HardwareAddrmarshals as raw bytes otherwise) and emits[]on an empty store, nevernull.class ls --jsonuses the lowercase canonical token (e.g."mobile"), so it round-trips straight back intonetwp class set.newListCmdhelper builds the threelssubcommands (same shape, one--jsonflag) instead of wiring the flag three times.Closes #72
Risks
None. Additive read-only flags; the default text output is unchanged.
Checklist
TestListJSONMappers: empty→[], MAC/class mapping)README.mdandREADME.pt-BR.mdupdated in this PR