feat: add current environment tracker

This commit is contained in:
2025-09-25 23:26:35 +05:30
parent 645418fe79
commit 54c23bad6f
4 changed files with 62 additions and 24 deletions

View File

@@ -44,6 +44,21 @@ func GetEnvy() (*toml.Tree, error) {
}
}
func WriteEnvy(tree *toml.Tree) error {
data, err := tree.Marshal()
if err != nil {
return err
}
cwd, err := os.Getwd()
if err != nil {
return err
}
os.WriteFile(path.Join(cwd, "envy.toml"), data, 0744)
return nil
}
func GetProject(name string) (Project, error) {
InitDb()
@@ -106,7 +121,7 @@ func ParseEnv(env string) string {
}
var comment = ""
if !enabled {
comment = "# "
comment = "#"
}
envs += fmt.Sprintf("%v%v=%v\n", comment, key, value)
}