diff --git a/CHANGELOG.md b/CHANGELOG.md index b9b2011d..f99da308 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Bugs * Fix bug where JsonStore was not being created #612 + * Fix fish shell completion ### New Features diff --git a/internal/helper/aws-sso.fish b/internal/helper/aws-sso.fish index e6d62e4a..e27a0f8a 100644 --- a/internal/helper/aws-sso.fish +++ b/internal/helper/aws-sso.fish @@ -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)" diff --git a/internal/utils/fileedit.go b/internal/utils/fileedit.go index ccc467ca..d78c7a9d 100644 --- a/internal/utils/fileedit.go +++ b/internal/utils/fileedit.go @@ -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 diff --git a/internal/utils/fileedit_test.go b/internal/utils/fileedit_test.go index 63afea77..10adec36 100644 --- a/internal/utils/fileedit_test.go +++ b/internal/utils/fileedit_test.go @@ -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()