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 PR fixes issue #306
There was error in this below function
https://github.com/goharbor/harbor-cli/blob/8dd8abb21c626fca3cb8488d027bb71c120967b0/pkg/utils/config.go#L171C1-L180C1
here we were creating a new viper client using
viper.new
and everywhere v as new client has been used instead viper should be used as it acts a global client for whole project and if v was used it acted as a local new client for that function only and because of this new client thecurrent-credential-name
string in below line was found to be empty as it had no context of the global configurationsharbor-cli/pkg/views/project/create/view.go
Line 25 in 8dd8abb
So I removed
viper.new
andv
and used viper directly in that function and now the create command works properly as expected