Skip to content

Commit

Permalink
Fix fish shell completions
Browse files Browse the repository at this point in the history
Original code didn't work at all and failed to install
if the ~/.config/fish/completions/ directory didn't exist
  • Loading branch information
synfinatic committed Oct 17, 2023
1 parent 882ce51 commit 40aba9e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Bugs

* Fix bug where JsonStore was not being created #612
* Fix fish shell completion

### New Features

Expand Down
1 change: 1 addition & 0 deletions internal/helper/aws-sso.fish
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ function __complete_aws-sso
and set COMP_LINE "$COMP_LINE "
{{ .Executable }}
end
complete -f -c aws-sso -a "(__complete_aws-sso)"
4 changes: 4 additions & 0 deletions internal/utils/fileedit.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ func (f *FileEdit) GenerateNewFile(configFile string) ([]byte, error) {
// read & write up to the prefix
input, err := os.Open(configFile)
if err != nil {
if err = EnsureDirExists(configFile); err != nil {
return []byte{}, err
}

input, err = os.Create(configFile)
if err != nil {
return []byte{}, err
Expand Down
6 changes: 4 additions & 2 deletions internal/utils/fileedit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ func TestFileEdit(t *testing.T) {
fmt.Sprintf(FILE_TEMPLATE, CONFIG_PREFIX, "foo", CONFIG_SUFFIX)), fBytes)

// can't open file
err = fe.UpdateConfig(false, true, "/this/directory/and/the/file/in/it/doesn't/exist")
assert.Error(t, err)
badfile := "./this/doesnt/exist"
err = fe.UpdateConfig(false, true, badfile)
assert.NoError(t, err)
defer os.Remove(badfile)

// setup logger for testing
logger, hook := test.NewNullLogger()
Expand Down

0 comments on commit 40aba9e

Please sign in to comment.