cli icon indicating copy to clipboard operation
cli copied to clipboard

cli/config: some minor cleanups

Open thaJeztah opened this issue 6 months ago • 2 comments

I have some more changes in this area, but need to dust it off; let's open these already as a PR 😅

cli/config/configfile: inline getConfiguredCredentialStore

It was a premature abstraction; the "nil" check for the map was redundant, making it literally a 1-liner, so just inline it.

cli/config/configfile: use more idiomatic receiver name

Use a shorter name, which is more idiomatic, and prevents accidental shadowing of types or arguments.

- Human readable description for the release notes



- A picture of a cute animal (not mandatory but encouraged)

thaJeztah avatar Aug 23 '25 00:08 thaJeztah

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests.

:loudspeaker: Thoughts on this report? Let us know!

codecov-commenter avatar Aug 23 '25 00:08 codecov-commenter

Hm... I messed up something;

#18 64.05 === FAIL: cli/config/configfile TestGetAllCredentialsCredsStore (0.00s)
#18 64.05     file_test.go:238: assertion failed: 
#18 64.05         --- expected
#18 64.05         +++ authConfigs
#18 64.05           map[string]types.AuthConfig{
#18 64.05         - 	"example.com": {Username: "user", Password: "pass"},
#18 64.05           }
#18 64.05         
#18 64.05     file_test.go:239: assertion failed: 1 (int) != 0 (testCredsStore.(*mockNativeStore).GetAllCallCount int)
#18 64.05 
#18 64.05 === FAIL: cli/config/configfile TestGetAllCredentialsCredStoreAndCredHelper (0.00s)
#18 64.05     file_test.go:402: assertion failed: 
#18 64.05         --- expected
#18 64.05         +++ authConfigs
#18 64.05           map[string]types.AuthConfig{
#18 64.05           	"credhelper.com": {Username: "cred_helper_user", Password: "cred_helper_pass"},
#18 64.05         - 	"credstore.com":  {Username: "cred_store_user", Password: "cred_store_pass"},
#18 64.05           }
#18 64.05         

thaJeztah avatar Aug 23 '25 00:08 thaJeztah