Add types.exclude pattern

This commit is contained in:
Pim van Pelt
2025-07-07 00:39:56 +02:00
parent 88e30a40b1
commit c8df809c29
5 changed files with 94 additions and 22 deletions

View File

@ -100,11 +100,13 @@ func main() {
user := deviceConfig.User
commands := deviceConfig.Commands
deviceType := deviceConfig.Type
var excludePatterns []string
// If device has a type, get commands from types section
// If device has a type, get commands and exclude patterns from types section
if deviceType != "" {
if typeConfig, exists := cfg.Types[deviceType]; exists {
commands = typeConfig.Commands
excludePatterns = typeConfig.Exclude
}
}
@ -127,7 +129,7 @@ func main() {
continue
}
err = backup.BackupCommands(commands, outputDir)
err = backup.BackupCommands(commands, excludePatterns, outputDir)
backup.Disconnect()
if err != nil {