adding lock command, generalizing the checkfiletypes function

This commit is contained in:
2020-06-04 17:38:26 -04:00
parent 0276a1d776
commit db2221c515
8 changed files with 348 additions and 118 deletions

View File

@@ -15,7 +15,7 @@ func IgnoreFiles(input string, inputType string, conf *clientconfig.Gvcconfig) e
ignore := conf.Ignores
switch inputType { // TODO: add default case for generic error handling
case "file":
err := checkIgnores(input, "file", ignore)
err := checkFileTypes(input, "file", ignore)
if err != nil {
return fmt.Errorf("%s already ignored: %s", input, err)
}
@@ -23,7 +23,7 @@ func IgnoreFiles(input string, inputType string, conf *clientconfig.Gvcconfig) e
conf.Ignores.Files = append(conf.Ignores.Files, input)
return nil
case "folder":
err := checkIgnores(input, "folder", ignore)
err := checkFileTypes(input, "folder", ignore)
if err != nil {
return fmt.Errorf("%s is already ignored: %s", input, err)
}
@@ -37,7 +37,7 @@ func IgnoreFiles(input string, inputType string, conf *clientconfig.Gvcconfig) e
} else {
wildcard = input
}
err := checkIgnores(wildcard, "wildcard", ignore)
err := checkFileTypes(wildcard, "wildcard", ignore)
if err != nil {
return fmt.Errorf("%s is already ignored: %s", input, err)
}
@@ -57,7 +57,7 @@ func RemoveIgnoreFiles(input string, inputType string, conf *clientconfig.Gvccon
ignore := conf.Ignores
switch inputType { // TODO: add default case for generic error handling
case "file":
err := checkIgnores(input, "file", ignore)
err := checkFileTypes(input, "file", ignore)
if err != nil {
fmt.Println("Removing file from ignores: ", input)
for i, fileIgnore := range ignore.Files {
@@ -72,7 +72,7 @@ func RemoveIgnoreFiles(input string, inputType string, conf *clientconfig.Gvccon
fmt.Println("File not found in ingores, unable to remove: ", input)
return nil
case "folder":
err := checkIgnores(input, "folder", ignore)
err := checkFileTypes(input, "folder", ignore)
if err != nil {
for i, folderIgnore := range ignore.Folders {
if input == folderIgnore {
@@ -92,7 +92,7 @@ func RemoveIgnoreFiles(input string, inputType string, conf *clientconfig.Gvccon
} else {
wildcard = input
}
err := checkIgnores(wildcard, "wildcard", ignore)
err := checkFileTypes(wildcard, "wildcard", ignore)
if err != nil {
for i, wildcardIgnore := range ignore.Exts {
if input == wildcardIgnore {