Skip to content

Commit

Permalink
Set paths and global variables to the universal scope
Browse files Browse the repository at this point in the history
  • Loading branch information
fedragon committed May 27, 2021
1 parent 2c8f3b8 commit 8a1c25b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Switch environment according to current working directory. Heavily inspired by t

Configure any combination of the following in a simple YAML file:
- ssh identities
- paths (to append to `$fish_user_paths`)
- global variables
- paths (to append to `$fish_user_paths`, which then becomes a _universal_ variable)
- global (= universal) variables
- git user email address

Whenever you visit a directory containing a `.cuttlefish.yaml` file, its configuration is applied to your environment.
Expand Down Expand Up @@ -79,6 +79,8 @@ make build

### Test

**Note:** This requires a running Docker daemon.

```
make test
```
Expand Down
4 changes: 2 additions & 2 deletions globals/globals.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ func Set(additions map[string]string, deletions []string) []string {

for _, key := range deletions {
if err := common.Validate(key); err == nil {
cmds = append(cmds, fmt.Sprintf("set --global --erase %v", key))
cmds = append(cmds, fmt.Sprintf("set --universal --erase %v", key))
}
}

for key, value := range additions {
if err := common.Validate(key); err == nil {
if err := common.Validate(value); err == nil {
cmds = append(cmds, fmt.Sprintf("set --global --export %v %v", key, value))
cmds = append(cmds, fmt.Sprintf("set --universal --export %v %v", key, value))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion paths/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func Set(additions []string, deletions []string) []string {

for _, path := range additions {
if err := common.Validate(path); err == nil {
cmds = append(cmds, fmt.Sprintf("contains %v $fish_user_paths; or set --global --export --append fish_user_paths %v", path, path))
cmds = append(cmds, fmt.Sprintf("contains %v $fish_user_paths; or set --universal --append fish_user_paths %v", path, path))
}
}

Expand Down

0 comments on commit 8a1c25b

Please sign in to comment.