diff options
| author | Mitch Riedstra <mitch@riedstra.us> | 2020-10-25 16:58:57 -0400 |
|---|---|---|
| committer | Mitch Riedstra <mitch@riedstra.us> | 2020-10-25 16:58:57 -0400 |
| commit | 5640cbe7d1433ff9a7a903f961d6f963c5880080 (patch) | |
| tree | b1c743c5588f29109aef9e9668bd20d398dda758 /main.go | |
| parent | 7752715a53155e4809f91e5894dfb2e9b3d35544 (diff) | |
| download | deduplicator-master.tar.gz deduplicator-master.tar.xz | |
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -162,6 +162,13 @@ func formatBytes(b int64) string { return s } +var VersionString = "" + +func VersionPrint() { + fmt.Println(VersionString) + os.Exit(0) +} + func main() { fl := flag.NewFlagSet("deduplicator", flag.ExitOnError) @@ -173,10 +180,19 @@ func main() { removeRegexStr := fl.String("regex", "", "Regular expression to match duplicated files") removeYes := fl.Bool("yes-i-want-my-data-gone", false, "Actually remove the files") matchPath := fl.Bool("match-path", false, "match on the path, rather than the filename") - cacheFile := fl.String("cache", "", "If not an empty string, the data gathered on a directory will be cached to the file, allowing subsequent runs to be near instant. No care is taken to check whether or not the cache is up to date with the current state of the directroy. If in doubt, leave empty.") + cacheFile := fl.String("cache", "", + `If not an empty string, the data gathered on a directory will be cached +to the file, allowing subsequent runs to be near instant. No care is +taken to check whether or not the cache is up to date with the current +state of the directroy. If in doubt, leave empty.`) + version := fl.Bool("v", false, "Print the version then exit") _ = fl.Parse(os.Args[1:]) + if *version { + VersionPrint() + } + if *remove && *removeRegexStr == "" { log.Fatal("A regular expression (-regex '<expr>') is required") } |
