Add init, status, and unlock commands#10
Merged
pascal-zarrad merged 10 commits intomainfrom Apr 10, 2026
Merged
Conversation
Add repository management commands that wrap restic operations: - conba init: initialize the restic repository (idempotent) - conba unlock: remove stale locks from the repository - conba status: show repo health, snapshot count, and size Includes restic wrapper methods (Unlock, Stats), arg builders, JSON parsing, integration tests, and CLI unit tests.
Disable zap stack traces for human log format (only useful at error/fatal). Add missing repository location error pattern to status command error handler.
Add requireResticConfig helper that checks repository and password are configured before calling restic. Gives clear error messages instead of leaking raw restic errors. Extract shared sentinel errors to helpers.go.
Fix double-output UX bug in status command by returning nil for known error states. Add missing tests for formatSize boundaries, handleStatusError paths, and RunE nil-config/missing-repo for init and unlock commands. Narrow gosec test exclusion to G101.
Add ResticConfig.Validate() method with ErrMissingRepository and ErrMissingPassword sentinel errors. CLI commands call Validate() before constructing the restic client. Validation logic belongs to the config type, not the CLI layer.
e48156a to
3b9340f
Compare
Move restic error classification to restic.ClassifyError with ErrRepoNotInitialized and ErrRepoLocked sentinels. Extract byte formatting to internal/format package for reuse.
Extract shared RunE test assertions to helpers_test.go to eliminate dupl violations. Keep only G101 gosec exclusion for test files (PasswordFile field triggers false positive).
Move ResticConfig.Validate() call into restic.New so the client cannot be constructed with missing repository or password. Remove redundant validation from CLI command handlers.
Extract restic stderr patterns into named constants and use switch/case for cleaner classification logic.
Move format.Bytes to internal/support/format and extract containsAny to internal/support/stringutil.ContainsAny for reuse across packages.
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.
Description
Add repository management commands that wrap restic operations:
Includes restic wrapper methods (Unlock, Stats), arg builders, JSON parsing, integration tests, and CLI unit tests.