Suppress the empty User setup wizard header when nothing to do#722
Merged
Conversation
Removing the existing-config reminder left a bare '-- User setup --' header printing with no content when the canonical users.yaml already exists. Gate the header (and the stray-leftover note) so the section emits output only on a first-time install or when a stray PROJECT_ROOT/users.yaml needs a warning; otherwise it stays silent.
When the canonical users.yaml exists, the user-setup section prints nothing, but the trailing print() separator still fired, leaving a blank line between the bot-token and transport prompts. Gate that separator on the same condition as the section header so it only appears when the section actually printed something.
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.
Summary
Follow-up to the wizard reminder cleanup (#721). Removing the
users.yaml already configured / edit it directly...reminder left the user-setup section printing noise on a re-run when the canonicalusers.yamlalready exists. This makes the whole section stay silent when there is nothing to do.Two parts:
-- User setup --header was still printed unconditionally, so it showed with no content under it.print()separator after the section still fired, leaving a blank line between theTelegram bot tokenandTelegram transportprompts.Both are now gated on the same "is there anything to show" condition. The section emits output only when:
users.yamlyet): header + admin prompts + trailing separator, as before.PROJECT_ROOT/users.yamlleftover: header + the "no longer used, move/remove it" note.The stray-leftover warning is preserved in both the first-time and existing-config paths.
Tests
make checkclean; full suite passes (4600 passed, 1 skipped). The existing-users wizard test asserts-- User setup --is absent when the canonical file exists; the header and the separator share one condition, so that assertion locks in both.