-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(install): Stop install if bundle in config
- Loading branch information
edwinvautier
committed
Apr 14, 2021
1 parent
97ba635
commit cc54004
Showing
5 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package bundles | ||
|
||
import ( | ||
"github.com/edwinvautier/go-cli/helpers" | ||
"github.com/edwinvautier/go-cli/services/filesystem" | ||
log "github.com/sirupsen/logrus" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
func FindBundlesInConfig() []string { | ||
workdir := filesystem.GetWorkdirOrDie() | ||
viper.AddConfigPath(workdir) | ||
viper.SetConfigName(".go-cli-config") | ||
viper.ReadInConfig() | ||
log.Info(viper.GetStringSlice("bundles")) | ||
|
||
return viper.GetStringSlice("bundles") | ||
} | ||
|
||
func IsInstalled(name string) bool { | ||
bundles := FindBundlesInConfig() | ||
|
||
return helpers.ContainsString(bundles, name) | ||
} |
This file contains 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
This file contains 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
This file contains 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