From d3ffddc37e5d766512b0bb08229a22936386814d Mon Sep 17 00:00:00 2001 From: Dar-rius Date: Mon, 7 Nov 2022 19:43:34 +0000 Subject: [PATCH] change env variable --- cmd/add.go | 2 +- cmd/go.go | 4 ++-- cmd/ls.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/add.go b/cmd/add.go index 6b069ae..530c302 100644 --- a/cmd/add.go +++ b/cmd/add.go @@ -50,7 +50,7 @@ func addProjectActually(project *Project) { //the add Project function allows you to search the json file and save the data concerning the project (name and path) func addProject(project *Project) { //the environment variable is stored in a variable in order to create and find the path.json file in the directory where the app is located - filEnv := os.Getenv("goproject") + filEnv := os.Getenv("gproject") _, errs := os.OpenFile(filEnv+"/path.json", os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600) if errs != nil { panic(errs) diff --git a/cmd/go.go b/cmd/go.go index 1e0f042..31edd7b 100644 --- a/cmd/go.go +++ b/cmd/go.go @@ -28,7 +28,7 @@ var goCmd = &cobra.Command{ // file and change directory by executing a shell command func goPath(project *string) { //the environment variable is stored in a variable in order to create and find the path.json file in the directory where the app is located - filEnv := os.Getenv("goproject") + filEnv := os.Getenv("gproject") viper.SetConfigName("path") viper.SetConfigType("json") viper.AddConfigPath(filEnv) @@ -61,7 +61,7 @@ func goPath(project *string) { func writeBash(dir *string) { //the command command := "cd " + *dir + "\n bash \n" - pathEnv := os.Getenv("goproject") + pathEnv := os.Getenv("gproject") data := []byte(command) err := ioutil.WriteFile(pathEnv+`/script.sh`, data, 0666) if err != nil { diff --git a/cmd/ls.go b/cmd/ls.go index 58810d7..e521eed 100644 --- a/cmd/ls.go +++ b/cmd/ls.go @@ -16,7 +16,7 @@ var lsCmd = &cobra.Command{ Long: `This command will list all the project saved in the path.json file.`, Run: func(cmd *cobra.Command, args []string) { //the environment variable is stored in a variable in order to create and find the path.json file in the directory where the app is located;w - filEnv := os.Getenv("goproject") + filEnv := os.Getenv("gproject") file, err := os.ReadFile(filEnv + "/path.json") if err != nil { log.Fatal("Error, there are no projects saved")