Repository navigation
Add --struct option to layout - #2
Merged
Merged
Conversation
Print the layout of only the named structs, once each and in file order, with the same numbers as the full listing. Documented in the README and covered by new tests.
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.
Requested by gulliby
Add a
--struct NAMEoption tostructpad layout.Before:
layoutalways printed every struct in the file, which is long when only one record matters, and a nested struct such asFramecannot be cut out of the file because it needsPacketandWiredefined before it.After:
structpad layout --struct Frame --struct Wire net.spprints only those structs, once each and in file order, with the same numbers as the full listing (nested structs are still resolved from the whole file).--struct=NAMEalso works, the option may appear anywhere and be repeated, and without it nothing changes.Errors exit with status 2 and one stderr line:
invalid --struct "X",--struct needs a value,suggest does not take --struct,check does not take --struct,unknown struct "X" in --struct.How:
src/structpad/cli.py(option parsing, validation, usage line) andsrc/structpad/render.py(render_layouttakes an optional selection), README section, the usage constant intests/test_cli.py, and 13 new tests intests/test_struct_select.py(131 in total). No dependency or CI changes.