Repository navigation
feat: draw generated files as a tree by default, --list for one per line - #61
Merged
Merged
Conversation
… line
The tree already existed, but only `--dry-run` drew it - a real run printed
one `schema -> destination` line per file. For a `lib` target that is a dozen
near-identical lines sharing a prefix, where the shape of the package is the
thing you actually want to see.
So the tree becomes how `generate` reports, dry run or not, and `--list`
brings back the per-file lines. The two flags are now independent: `--dry-run`
decides whether anything is written, `--list` how it is reported, and they
combine.
`--list` keeps the one thing a tree can't show: which schema each file came
from (`api.ids -> generated/rust/api.rs`), and the `[version]` tag when
several package versions are generated at once. The tree doesn't need that
tag - multi-version output requires `{{package_version}}` in `layout`, so
each tree's root names its own version.
Three tests asserted the old default. Rather than just moving them behind
`--list`, they now cover both renderings: `plain` has two ASCII surfaces (the
branch glyphs and the arrow) and checks each, and the multi-version test
asserts the version shows up in the tree root as well as in `--list`'s tag.
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.
Reported from a transcript: the tree looked like the right way for
generateto report, but it only ever appeared under
--dry-run. A real run printed oneline per file.
For a
libtarget that's a dozen near-identical lines sharing a prefix, whenthe shape of the generated package is the thing worth seeing:
The tree is now how
generatereports, dry run or not.--listbrings backthe per-file lines.
--dry-runand--listare independentPreviously
--dry-runimplied the tree and there was no way to get eitherrendering with the other behaviour. Now one flag decides whether anything is
written and the other how it's reported, and they combine.
What
--listkeepsThe schema each file came from —
api.ids → generated/rust/api.rs— which atree of destinations can't show, and the
[0.0.1]tag when several packageversions are generated at once.
The tree doesn't need that tag: multi-version output requires
{{package_version}}inlayout, so each tree's own root names its version(
generated/rust/0.0.1/). The multi-version test now asserts that ratherthan taking it on trust.
Tests
Three tests asserted the old default. Rather than just moving them behind
--list, each now covers both renderings:plain_uses_ascii_arrow→plain_uses_ascii_output: plain mode has twoASCII surfaces now, the branch glyphs and the arrow, so it checks both
--list's tagPlus two new ones:
--listnaming the source schema, and--dry-run --listcombining (writing nothing while listing).
29 + 63 green, fmt and clippy clean. Verified by eye on a real two-target
project in
codeandlibmode, under--plain(ASCII branches) and--quiet(silent).Docs follow once this is installed —
scripts/check-cli-drift.pycomparescli.mdagainst the installed binary, so documenting--listfirst wouldfail that check.