mirror of
https://github.com/silicoflare/envy.git
synced 2026-05-26 19:57:59 +05:30
feat: change project config file name to envy.toml
This commit is contained in:
16
cmd/pin.go
16
cmd/pin.go
@@ -17,10 +17,10 @@ import (
|
||||
// pinCmd represents the pin command
|
||||
var pinCmd = &cobra.Command{
|
||||
Use: "pin",
|
||||
Short: "Pin an environment to the .envy file",
|
||||
Short: "Pin an environment to the envy.toml file",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
var env = ""
|
||||
if len(args) > 0 {
|
||||
if len(args) > 0 {
|
||||
env = args[0]
|
||||
}
|
||||
|
||||
@@ -32,10 +32,10 @@ var pinCmd = &cobra.Command{
|
||||
dbProject, err := utils.GetProject(project)
|
||||
utils.StopIfErr(err)
|
||||
|
||||
if env != "" {
|
||||
if env != "" {
|
||||
_, err := utils.GetEnvironment(dbProject.ID, env)
|
||||
utils.StopIfErr(err)
|
||||
} else {
|
||||
} else {
|
||||
envs, err := utils.GetEnvironments(dbProject.ID)
|
||||
utils.StopIfErr(err)
|
||||
|
||||
@@ -44,9 +44,9 @@ var pinCmd = &cobra.Command{
|
||||
huh.NewSelect[string]().
|
||||
Title("Select environment").
|
||||
Description("Select an environment to pin").
|
||||
OptionsFunc(func () []huh.Option[string] {
|
||||
OptionsFunc(func() []huh.Option[string] {
|
||||
var options []huh.Option[string]
|
||||
for _, en := range envs {
|
||||
for _, en := range envs {
|
||||
options = append(options, huh.NewOption(en.Name, en.Name))
|
||||
}
|
||||
return options
|
||||
@@ -57,7 +57,7 @@ var pinCmd = &cobra.Command{
|
||||
|
||||
err = form.Run()
|
||||
utils.StopIfErr(err)
|
||||
if env == "" {
|
||||
if env == "" {
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ var pinCmd = &cobra.Command{
|
||||
|
||||
cwd, err := os.Getwd()
|
||||
utils.StopIfErr(err)
|
||||
os.WriteFile(path.Join(cwd, ".envy"), data, 0744)
|
||||
os.WriteFile(path.Join(cwd, "envy.toml"), data, 0744)
|
||||
|
||||
fmt.Println("Pinned", env, "to the project.")
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user