private void SetConfigProfileDetails() { //config path not assigned in cmdlet invocation if (ConfigPath == null) { ConfigPath = util.PromptFullPath($"{CONFIG_FILE_PROMPT} [{DEFAULT_CONFIG_PATH}]", CONFIG_FILE_PROPERTY); } else { ConfigPath = util.GetSessionAbsPath(ConfigPath); } //Assume default path if the user didn't enter a path if (string.IsNullOrEmpty(ConfigPath)) { ConfigPath = DEFAULT_CONFIG_PATH; } Host.UI.WriteLine($"{CONFIG_FILE_INFO} {ConfigPath}"); if (File.Exists(ConfigPath)) { bool addProfile = util.PromptYesNoChoice($"Config file {ConfigPath} already exists. Do you want add a profile here?" + " (If no, you will be prompted to overwrite the file)", true); if (addProfile) { if (String.IsNullOrEmpty(ProfileName) || ValidateProfileName(ProfileName) == null) { ProfileName = util.PromptValidateString(PROFILE_PROMPT, PROFILE_PROPERTY, ValidateProfileName); } } else { bool deleteConfig = util.PromptYesNoChoice($"File {ConfigPath} already exists. Do you want to overwrite (Removes existing profiles!!!)?", false); if (deleteConfig) { util.InformDeleteFile(ConfigPath); } else { throw new Exception($"Avoid overwriting existing config at {ConfigPath}. Config setup terminated!"); } } } //Assume default profile name if the user hasn't specified one if (String.IsNullOrEmpty(ProfileName)) { ProfileName = DEFAULTPROFILE; } ProfileName = ProfileName.ToUpperInvariant(); }