working on merging configs, adding branch/switch/pull commands

This commit is contained in:
2020-06-10 22:45:15 -04:00
parent c4aa5a1c66
commit 2cbdf21a81
12 changed files with 269 additions and 66 deletions

View File

@@ -36,3 +36,17 @@ func CheckFileTypes(input string, inputType string, excludeList FileTypes) error
}
return nil
}
// RemoveDuplicatesFromSlice is used when merging configs, just purges duplicates from slice
func RemoveDuplicatesFromSlice(slice []string) []string {
seen := make(map[string]bool)
result := []string{}
for _, entry := range slice {
if _, value := seen[entry]; !value {
seen[entry] = true
result = append(result, entry)
}
}
return result
}

View File

@@ -1,22 +1,17 @@
package common
//FileTypes is for ignoring files to add or ignoring compress, or for locked files, all use the same type of struct (files, folders and exts)
// type FileTypes struct {
// Files []string `toml:"files"`
// Exts []string `toml:"exts"`
// Folders []string `toml:"folders"`
// }
// FileTypes is for ignoring files to add or ignoring compress, or for locked files, all use the same type of struct (files, folders and exts)
type FileTypes struct {
Files map[string]string `toml:"files"`
Folders map[string]string `toml:"folders"`
Exts map[string]string `toml:"exts"`
Files []string `toml:"files"`
Exts []string `toml:"exts"`
Folders []string `toml:"folders"`
}
// RepoRefreshRequest returns locks, ignores, and commits/branches. Server marshals into this, client unmarshals
type RepoRefreshRequest struct {
Branches []string // List of known branches on server
Commits string //TODO: This will be pulled from DB and be a different type
Locked FileTypes
Ignores FileTypes
Branches []string // List of known branches on server
Commits string //TODO: This will be pulled from DB and be a different type
Locked FileTypes
Ignores FileTypes
NoCompress FileTypes
}