From 90480dd49be33ad74a324b04c42f063474e282ea Mon Sep 17 00:00:00 2001 From: Pjotr Savitski Date: Mon, 5 Sep 2022 15:00:10 +0300 Subject: [PATCH] Fixed an issue with wrong isage examples. Usage exampled in README file and help text were using the wrong order of path and limit parameters. The correct one is that parameters should be provided before the path to directory. Tagging a new patch release version 1.0.1. --- README.md | 2 +- cleanup.go | 4 ++-- cleanup_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 867ba2e..cf1ed72 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Modification time will be used when determining the sort order of subdirectories ## Usage examples -* `cleanup -l 5` keeps up to 5 latest subdirectories of the path provided +* `cleanup -l 5 ` keeps up to 5 latest subdirectories of the path provided * `cleanup ` keeps up to 5 (default value) subdirectories of the path provided * `cleanup -v` displays the version information of the utility script * `cleanup` - displays help text of the utility script diff --git a/cleanup.go b/cleanup.go index 6239d12..2290b55 100644 --- a/cleanup.go +++ b/cleanup.go @@ -13,7 +13,7 @@ import ( ) const ( - version = "1.0.0" + version = "1.0.1" ) var ( @@ -109,7 +109,7 @@ func realMain(out io.Writer) int { flag.IntVar(&limit, "l", 5, "Limit of the latest directories to keep") flag.Usage = func() { - _, err := fmt.Fprintln(out, "Usage: cleanup path/to/dir -l 5") + _, err := fmt.Fprintln(out, "Usage: cleanup -l 5 path/to/dir") if err != nil { return } diff --git a/cleanup_test.go b/cleanup_test.go index d61851a..5bdb705 100644 --- a/cleanup_test.go +++ b/cleanup_test.go @@ -195,7 +195,7 @@ func TestRealMain(t *testing.T) { {"limit set to default and tmp_data", []string{tmpDataDirectory}, 0, ""}, {"limit set to default and wrong dir", []string{nonExistentPath}, 1, fmt.Sprintf("Not a directory or path \"%s\" does not exist!", nonExistentPath)}, {"limit set to default and file", []string{filepath.Join(tmpDataDirectory, "file")}, 1, fmt.Sprintf("Not a directory or path \"%s\" does not exist!", path.Join(tmpDataDirectory, "file"))}, - {"limit set to default and no dir", []string{}, 0, "Usage: cleanup path/to/dir -l 5\n -l int\n \tLimit of the latest directories to keep (default 5)\n -v\tRelease version of the utility script\n"}, + {"limit set to default and no dir", []string{}, 0, "Usage: cleanup -l 5 path/to/dir\n -l int\n \tLimit of the latest directories to keep (default 5)\n -v\tRelease version of the utility script\n"}, {"version flag set", []string{"-v"}, 0, "Cleanup utility version: " + version + "\n"}, {"version flag set", []string{"--v"}, 0, "Cleanup utility version: " + version + "\n"}, {"version flag set to true", []string{"-v", "false"}, 0, "Cleanup utility version: " + version + "\n"},