feat: add storage dir for modctl #38
Merged
+62
−44
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.
This pull request includes several changes to the
modctl
command-line tool, primarily focusing on configuring and using a storage directory specified by the user. The most important changes include modifying backend initialization to accept a storage directory, updating command files to pass the storage directory, and adding a new configuration package to manage the root configuration.Backend initialization:
pkg/backend/backend.go
: Modified theNew
function to accept astorageDir
parameter.pkg/storage/factory.go
: Updated theNew
function to accept astorageDir
parameter and removed default content directory functions. [1] [2]Command file updates:
cmd/build.go
,cmd/extract.go
,cmd/inspect.go
,cmd/list.go
,cmd/login.go
,cmd/logout.go
,cmd/prune.go
,cmd/pull.go
,cmd/push.go
,cmd/rm.go
: Updated the backend initialization to passrootConfig.StoargeDir
as the storage directory. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Configuration management:
cmd/root.go
: Introduced a newrootConfig
variable and initialized it with theNewRoot
function from the newconfig
package. Added a persistent flag for specifying the storage directory. [1] [2]pkg/config/root.go
: Added a newconfig
package with aRoot
struct to manage the storage directory configuration.