From 5640cbe7d1433ff9a7a903f961d6f963c5880080 Mon Sep 17 00:00:00 2001 From: Mitch Riedstra Date: Sun, 25 Oct 2020 16:58:57 -0400 Subject: Add a build script. Basic readme. License file. --- main.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'main.go') diff --git a/main.go b/main.go index a84eadb..737a148 100644 --- a/main.go +++ b/main.go @@ -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 '') is required") } -- cgit v1.2.3