update config handling and add support for removing config

This commit is contained in:
Sahilb315
2025-12-17 15:41:04 +05:30
parent 3a1afccb9e
commit 0d5bdefe04
6 changed files with 139 additions and 22 deletions
+13
View File
@@ -46,6 +46,19 @@ func CreatePmgConfigDir() (string, error) {
return dir, nil
}
// RemovePmgConfigDir removes the PMG configuration directory and its contents.
func RemovePmgConfigDir() error {
dir, err := PmgConfigDir()
if err != nil {
return err
}
if err := os.RemoveAll(dir); err != nil {
return fmt.Errorf("failed to remove config directory %s: %w", dir, err)
}
return nil
}
// ConfigFilePath returns the absolute path to the main PMG config file (e.g., config.yml),
// without creating any directories.
func ConfigFilePath() (string, error) {