Skip to content

Commit

Permalink
Fixed an issue with wrong isage examples.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pjotrsavitski committed Sep 5, 2022
1 parent 9f4ff2b commit 90480dd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Modification time will be used when determining the sort order of subdirectories

## Usage examples

* `cleanup <PATH-TO-DIRECTORY> -l 5` keeps up to 5 latest subdirectories of the path provided
* `cleanup -l 5 <PATH-TO-DIRECTORY>` keeps up to 5 latest subdirectories of the path provided
* `cleanup <PATH-TO-DIRECTORY>` 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
Expand Down
4 changes: 2 additions & 2 deletions cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

const (
version = "1.0.0"
version = "1.0.1"
)

var (
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion cleanup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down

0 comments on commit 90480dd

Please sign in to comment.