-
Notifications
You must be signed in to change notification settings - Fork 31
feat(config): add ignore-existing for profile create #1094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -80,7 +80,7 @@ func GetProfileFromEnv() (string, bool) { | |||||||||||||||||
| // If emptyProfile is true, it creates an empty profile. Otherwise, copies the config from the current profile to the new profile. | ||||||||||||||||||
| // If setProfile is true, it sets the new profile as the active profile. | ||||||||||||||||||
| // If the profile already exists, it returns an error. | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
| func CreateProfile(p *print.Printer, profile string, setProfile, emptyProfile bool) error { | ||||||||||||||||||
| func CreateProfile(p *print.Printer, profile string, setProfile, ignoreExising, emptyProfile bool) error { | ||||||||||||||||||
| err := ValidateProfile(profile) | ||||||||||||||||||
| if err != nil { | ||||||||||||||||||
| return fmt.Errorf("validate profile: %w", err) | ||||||||||||||||||
|
|
@@ -98,6 +98,9 @@ func CreateProfile(p *print.Printer, profile string, setProfile, emptyProfile bo | |||||||||||||||||
| // Error if the profile already exists | ||||||||||||||||||
| _, err = os.Stat(configFolderPath) | ||||||||||||||||||
| if err == nil { | ||||||||||||||||||
| if ignoreExising { | ||||||||||||||||||
| return nil | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Currently the value of When creating a profile with
|
||||||||||||||||||
| } | ||||||||||||||||||
| return fmt.Errorf("profile %q already exists", profile) | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo