Repository navigation
refactor(cli): split cmdPull and share the login step with push - #59
Merged
Merged
Conversation
main_test checked exit codes only. TestPullOutput runs pull against a small fake wiki and compares stdout, stderr and the exit code for each kind of report line: categories walked, a refresh, pulled pages, local edits, missing pages, filename collisions, the watchlist login and its missing titles, translations left out, and an empty selection.
cmdPull was 105 lines. The credential lookup and login it shared with cmdPush are now login(); the report lines and exit code are printPullReport(); PullReport.Total() replaces the outcome count that was written out twice. cmdPull is 68 lines. Output and exit codes are unchanged: TestPullOutput, TestLoginNeedsCredentials and the login failure check in TestPullWatchlistLogsInFirst pass on the code before and after. Closes #49
CameronBrooks11
added a commit
that referenced
this pull request
Nov 13, 2026
Prepares v0.5.1: the version constant becomes 0.5.1, and the CHANGELOG's Unreleased section becomes 0.5.1. User-facing changes since v0.5.0: #52 (HTTP status on login and edit errors, #45), #53 (conflict check reads the revision id only, #46), #61 (login failure and count wording, #56), #62 (push read-back warning, #58). The rest are refactors with no change in behaviour: #54, #55, #57, #59, #60. The tag is pushed after this merges.
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.
Two commits:
Tests that pin
pull's output.main_test.gochecked exit codes only.TestPullOutputrunspullagainst a small fake wiki and compares stdout, stderr and the exit code for every kind of report line:TestLoginNeedsCredentialsand a stderr check inTestPullWatchlistLogsInFirstpin the login messages of bothpullandpush.The refactor.
login()replaces the credential lookup and login thatcmdPullandcmdPusheach had.printPullReport()takes the report lines and the exit code.PullReport.Total()replaces the outcome count that was written out twice.cmdPullgoes from 105 to 68 lines.All three tests pass on the code before and after the refactor. Dropping
MissingfromTotal()makesTestPullOutputfail with an extrano pages matched.No change to output or exit codes.
Closes #49