mirror of
https://github.com/silicoflare/envy.git
synced 2026-05-26 19:57:59 +05:30
feat: refactor env file when creating environment
This commit is contained in:
@@ -3,7 +3,6 @@ package cmd
|
||||
import (
|
||||
"envy/cmd/utils"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
@@ -72,6 +71,9 @@ var createCmd = &cobra.Command{
|
||||
err = utils.WriteEnvy(envy)
|
||||
utils.StopIfErr(err)
|
||||
|
||||
err = utils.RefactorEnv()
|
||||
utils.StopIfErr(err)
|
||||
|
||||
fmt.Printf("Created environment %s for project %s.\n", environment, project)
|
||||
}
|
||||
|
||||
@@ -129,10 +131,10 @@ var createCmd = &cobra.Command{
|
||||
filePath := path.Join(cwd, "envy.toml")
|
||||
|
||||
err = os.WriteFile(filePath, []byte(fmt.Sprintf("[envy]\nproject = \"%s\"\nenv = \"%s\"\ncurrent = \"%s\"\n", project, environment, environment)), 0644)
|
||||
if err != nil {
|
||||
log.Println("Error creating envy.toml file:", err)
|
||||
return
|
||||
}
|
||||
utils.StopIfErr(err)
|
||||
|
||||
err = utils.RefactorEnv()
|
||||
utils.StopIfErr(err)
|
||||
|
||||
fmt.Printf("Created environment %s inside of project %s.\n", environment, project)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user