moving a function and struct over to a common library, starting on lockfile for server
This commit is contained in:
@@ -31,36 +31,6 @@ func validateFileType(path string, inputType string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func checkFileTypes(input string, inputType string, ignores clientconfig.FileTypes) error {
|
||||
switch inputType {
|
||||
case "file":
|
||||
fileExt := filepath.Ext(input) // TODO more sanity checking on ext
|
||||
for _, ignoredExt := range ignores.Exts {
|
||||
if fileExt == ignoredExt {
|
||||
return fmt.Errorf("file ext is on ignored list, cannot add file with file ext %s", fileExt)
|
||||
}
|
||||
}
|
||||
for _, ignoredFile := range ignores.Files {
|
||||
if input == ignoredFile {
|
||||
return fmt.Errorf("file name is on ignored list, cannot add file with name %s", input)
|
||||
}
|
||||
}
|
||||
case "folder":
|
||||
for _, ignoredFolder := range ignores.Folders {
|
||||
if input == ignoredFolder {
|
||||
return fmt.Errorf("folder name is on the ignored list, cannot add folder with name %s", input)
|
||||
}
|
||||
}
|
||||
case "wildcard":
|
||||
for _, ignoredExt := range ignores.Exts {
|
||||
if input == ignoredExt {
|
||||
return fmt.Errorf("cannot add wildcard, since that ext is already added to the ignore config %s", input)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// FindServer finds the supplied server connection settings, creates a connection string and returns it
|
||||
func FindServer(serverName string, branchName string, conf *clientconfig.Gvcconfig) (connectionString string, err error) {
|
||||
if branchName == "" { // If no branch listed select master TODO: in future the 'default' branch will be their current branch
|
||||
|
Reference in New Issue
Block a user