Skip to content

Commit 2bd1121

Browse files
authored
docs: enhance README and update command line flags (#229)
* docs: update readme with suggestions * fix: update command documentation in the app
1 parent ebedc33 commit 2bd1121

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

README.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
rmstale is a tool to remove stale files recursively below a given directory.
99
Files and folders older than a defined period are removed.
10+
A file is considered stale if it has not been modified in the last N days, where N is the value provided for the `--age` flag.
11+
This tool will also remove directories that are considered stale (older than the defined period) and are empty.
12+
1013

1114
Some examples for use:
1215

@@ -28,9 +31,14 @@ Some examples for use:
2831
Visit the releases page to find the [latest release](https://github.com/danstis/rmstale/releases/latest) version.
2932

3033
```bash
31-
curl -L -o /tmp/rmstale.tar.gz "https://github.com/danstis/rmstale/releases/download/v1.15.2/rmstale_1.15.2_linux_amd64.tar.gz"
32-
sudo tar -xzf /tmp/rmstale.tar.gz -C /usr/bin rmstale
33-
rm /tmp/rmstale.tar.gz
34+
# Fetch the latest release tag from GitHub
35+
latest_version=$(curl -s https://api.github.com/repos/danstis/rmstale/releases/latest | grep -Po '"tag_name": "\K.*?(?=")')
36+
# Download the latest version tarball
37+
curl -L -o rmstale.tar.gz "https://github.com/danstis/rmstale/releases/download/$latest_version/rmstale_${latest_version#v}_linux_amd64.tar.gz"
38+
# Extract and install
39+
sudo tar -xzf rmstale.tar.gz -C /usr/bin rmstale
40+
# Cleanup
41+
rm rmstale.tar.gz
3442
```
3543

3644
### Install rmstale manually
@@ -42,21 +50,21 @@ rm /tmp/rmstale.tar.gz
4250

4351
### Command line flags
4452

45-
| Flag | Description |
46-
| --------------- | ------------------------------------------------------------------------ |
47-
| -a, --age | Period in days before an item is considered stale |
48-
| -d, --dry-run | Runs the process in dry-run mode, no files will be removed. |
49-
| -e, --extension | Filter files for a defined file extension |
50-
| -p, --path | Path to a folder to process |
51-
| -v, --version | Displays the version of rmstale that is currently running |
52-
| -y, --confirm | Allows for processing without confirmation prompt, useful for scheduling |
53+
| Flag | Description |
54+
| --------------- | ------------------------------------------------------------------------------------------------------------------ |
55+
| -a, --age | Period in days before an item is considered stale. |
56+
| -d, --dry-run | Runs the process in dry-run mode. No files will be removed, but the tool will log the files that would be deleted. |
57+
| -e, --extension | Filter files for a defined file extension. This flag only applies to files, not directories. |
58+
| -p, --path | Path to a folder to process. |
59+
| -v, --version | Displays the version of rmstale that is currently running. |
60+
| -y, --confirm | Allows for processing without confirmation prompt, useful for scheduling. |
5361

5462
### Usage examples
5563

5664
```cmd
5765
>: rmstale --version
5866
59-
rmstale v1.6.0
67+
rmstale v1.2.3
6068
```
6169

6270
```cmd
@@ -70,6 +78,8 @@ WARNING: Will remove files and folders recursively below 'c:\temp' older than 14
7078
-Removing 'C:\Temp\amc308D.tmp.LOG1'...
7179
```
7280

81+
Any errors encountered during the deletion process (e.g., permission issues) will be logged.
82+
7383
## GitHub project
7484

7585
Feedback, Issues, Bugs and Contribution to this tool are welcome.

rmstale.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ var AppVersion = "0.0.0"
2020

2121
const usage = `Usage of rmstale:
2222
-a, --age Period in days before an item is considered stale.
23-
-d, --dry-run Runs the process in dry-run mode, no files will be removed.
24-
-e, --extension Filter files for a defined file extension.
23+
-d, --dry-run Runs the process in dry-run mode. No files will be removed, but the tool will log the files that would be deleted.
24+
-e, --extension Filter files for a defined file extension. This flag only applies to files, not directories.
2525
-p, --path Path to a folder to process.
2626
-v, --version Displays the version of rmstale that is currently running.
2727
-y, --confirm Allows for processing without confirmation prompt, useful for scheduling.

0 commit comments

Comments
 (0)