Validate profile before switching
Closed this issue · 4 comments
We need to catch the exception of a PROFILE_NAME.config.json
not existing and prompt the user to create one instead of simply switching to the profile name in the profile.json
parameter without any checks
When you switch to one that doesn't exist yet, it's created as you add override settings.
spark config foo
spark config foo apiUrl https://foo.biz/api
Yup yup..but it's not helping the user during typos :) except if you execute spark config identify
after running into issues.
Running spark config PROFILE_NAME
for one that doesn't exists essentially does nothing (no new .json file created as well). Also you probably don't want to create an empty profile on first start
1.) Without any override settings, it should validate against the available .json files
2.) With override settings, it means you are creating/edit a profile so no validation sounds ok
hmm, sure, so a quick prompt with something like:
"Hey cool! That profile doesn't exist yet, create it? [Y/n]"
Sounds good for sure! 👍