Skip to content

cli: split cmdPull and share the login step with push #49

Closed

Description

@CameronBrooks11

cmdPull is 105 lines: flag parsing, flag validation, login, the pull, then nine kinds of report line and the exit code.

  • The login step is copied in cmdPull and cmdPush (look up credentials, print the hint, log in, report failure), with slightly different messages.
  • The sum of outcomes (len(rep.Written)+len(rep.Missing)+len(rep.SkippedDirty)+len(rep.Collisions)) is written out twice, once as a sum and once as four == 0 checks.

Fix: a login helper both commands use; the report printing and exit code move into their own function; PullReport gets a method for its outcome count. Output and exit codes stay byte-for-byte the same. main_test.go checks only exit codes, so tests that pin pull's exact output come first and must pass before and after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions