-
Notifications
You must be signed in to change notification settings - Fork 1
Add CLI --help examples and scheduling documentation #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,70 @@ | ||||||||||||||
| # Scheduled Runs | ||||||||||||||
|
|
||||||||||||||
| Use scheduled jobs to run cache cleanup during low-usage hours. | ||||||||||||||
|
|
||||||||||||||
| ## cron (Linux/macOS) | ||||||||||||||
|
|
||||||||||||||
| Weekly at 3:00 AM every Sunday: | ||||||||||||||
|
|
||||||||||||||
| ```cron | ||||||||||||||
| 0 3 * * 0 /usr/local/bin/dev-cache --scan ~/src --clean --yes >> ~/cache-cleaner.log 2>&1 | ||||||||||||||
| 0 3 * * 0 /usr/local/bin/git-cleaner --scan ~/src --clean >> ~/cache-cleaner.log 2>&1 | ||||||||||||||
| 0 3 * * 0 /usr/local/bin/mac-cache-cleaner --clean >> ~/cache-cleaner.log 2>&1 | ||||||||||||||
|
Comment on lines
+10
to
+12
|
||||||||||||||
| 0 3 * * 0 /usr/local/bin/dev-cache --scan ~/src --clean --yes >> ~/cache-cleaner.log 2>&1 | |
| 0 3 * * 0 /usr/local/bin/git-cleaner --scan ~/src --clean >> ~/cache-cleaner.log 2>&1 | |
| 0 3 * * 0 /usr/local/bin/mac-cache-cleaner --clean >> ~/cache-cleaner.log 2>&1 | |
| 0 3 * * 0 /usr/local/bin/dev-cache --scan "$HOME/src" --clean --yes >> "$HOME/cache-cleaner.log" 2>&1 | |
| 0 3 * * 0 /usr/local/bin/git-cleaner --scan "$HOME/src" --clean >> "$HOME/cache-cleaner.log" 2>&1 | |
| 0 3 * * 0 /usr/local/bin/mac-cache-cleaner --clean >> "$HOME/cache-cleaner.log" 2>&1 |
Copilot
AI
Mar 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For scheduled runs, environment differs from interactive shells (cron/launchd often have a minimal PATH). Since mac-cache-cleaner can invoke tools like brew/docker/npm from its config, the docs should mention ensuring PATH is set appropriately (e.g., via a PATH=... line in crontab and EnvironmentVariables in the launchd plist). Otherwise scheduled cleanups may fail even if the mac-cache-cleaner binary path is absolute.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,17 @@ var ( | |
| flagClean = flag.Bool("clean", false, "Run git gc in each repository and show disk savings") | ||
| ) | ||
|
|
||
| func init() { | ||
| flag.Usage = func() { | ||
| out := flag.CommandLine.Output() | ||
| fmt.Fprintf(out, "Usage: git-cleaner --scan <directory> [flags]\n\nFlags:\n") | ||
| flag.PrintDefaults() | ||
| fmt.Fprintf(out, "\nExamples:\n") | ||
| fmt.Fprintf(out, " git-cleaner --scan ~/src # Scan for .git directories\n") | ||
| fmt.Fprintf(out, " git-cleaner --scan ~/src --clean # Optimize with git gc\n") | ||
| } | ||
|
Comment on lines
+30
to
+38
|
||
| } | ||
|
|
||
| // ----- Finding types ----- | ||
|
|
||
| type Finding struct { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,6 +65,18 @@ var ( | |
| flagDetails = flag.Bool("details", false, "Show detailed per-directory information") | ||
| ) | ||
|
|
||
| func init() { | ||
| flag.Usage = func() { | ||
| out := flag.CommandLine.Output() | ||
| fmt.Fprintf(out, "Usage: mac-cache-cleaner [flags]\n\nFlags:\n") | ||
| flag.PrintDefaults() | ||
| fmt.Fprintf(out, "\nExamples:\n") | ||
| fmt.Fprintf(out, " mac-cache-cleaner # Scan all targets (dry-run)\n") | ||
| fmt.Fprintf(out, " mac-cache-cleaner --clean # Run cleanup commands\n") | ||
| fmt.Fprintf(out, " mac-cache-cleaner --targets docker,npm # Specific targets only\n") | ||
| } | ||
|
Comment on lines
+68
to
+77
|
||
| } | ||
|
|
||
| // ----- Config types ----- | ||
|
|
||
| type Config struct { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The custom --help output omits the supported -version/--version option (handled via checkVersionFlag), so users won't discover it from help. Consider adding a short line for -version/--version in the usage output near the flags section.