Skip to content

Commit

Permalink
change env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Dar-rius committed Nov 7, 2022
1 parent cdecd76 commit d3ffddc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions cmd/go.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit d3ffddc

Please sign in to comment.