-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
83 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
scriptdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
basedir=$(echo "${scriptdir%/*}") | ||
|
||
r "${basedir}/testdata/tmp" -r ".*" --remove -m 1m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package logaxe | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
) | ||
|
||
func askForConfirmation(filename string) bool { | ||
okayResponses := []string{"y", "Y", "yes", "Yes", "YES"} | ||
nokayResponses := []string{"n", "N", "no", "No", "NO"} | ||
fmt.Printf( | ||
"Type %s to confirm deletion of %q ", | ||
okayResponses, filename, | ||
) | ||
var response string | ||
_, err := fmt.Scanln(&response) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
if containsString(okayResponses, response) { | ||
return true | ||
} else if containsString(nokayResponses, response) { | ||
return false | ||
} else { | ||
return askForConfirmation(filename) | ||
} | ||
} | ||
|
||
func posString(slice []string, element string) int { | ||
for index, elem := range slice { | ||
if elem == element { | ||
return index | ||
} | ||
} | ||
return -1 | ||
} | ||
|
||
func containsString(slice []string, element string) bool { | ||
return !(posString(slice, element) == -1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ func main() { | |
CLI.Format, | ||
CLI.MaxAge, | ||
CLI.Remove, | ||
CLI.Yes, | ||
CLI.SkipTruncate, | ||
CLI.DryRun, | ||
lg, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters