Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v0.0.4 (October 4, 2023)
* Don't append default profile if it already exists.

## v0.0.3 (September 22, 2023)
* Added additional error checking.

Expand Down
13 changes: 11 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const (
CyanColor = "\033[0;36m%s\033[0m"
)

var version string = "v0.0.3"
var version string = "v0.0.4"

func newPromptUISearcher(items []string) list.Searcher {
return func(searchInput string, itemIndex int) bool {
Expand Down Expand Up @@ -116,11 +116,20 @@ func getProfiles(profileFileLocation string) []string {
log.Fatal(err)
}

profiles = append(profiles, "default")
profiles = appendIfNotExists(profiles, "default")
sort.Strings(profiles)
return profiles
}

func appendIfNotExists(slice []string, s string) []string {
for _, v := range slice {
if v == s {
return slice
}
}
return append(slice, s)
}

func getenv(key, fallback string) string {
value := os.Getenv(key)
if len(value) == 0 {
Expand Down