diff --git a/README.md b/README.md index a3accbb..57c7a2b 100644 --- a/README.md +++ b/README.md @@ -49,27 +49,43 @@ Remove unused GitHub forks ```txt Usage of fork-sweeper: - -delete - Delete forked repos - -max-page int - Maximum number of pages to fetch (default 100) - -older-than-days int - Fetch forked repos modified more than n days ago (default 60) - -owner string - GitHub repo owner (required) - -per-page int - Number of forked repos fetched per page (default 100) - -token string - GitHub access token (required) - -version - Print version + -delete + Delete forked repos + -guard value + List of repos to protect from deletion (fuzzy match name) + -max-page int + Maximum number of pages to fetch (default 100) + -older-than-days int + Fetch forked repos modified more than n days ago (default 60) + -owner string + GitHub repo owner (required) + -per-page int + Number of forked repos fetched per page (default 100) + -token string + GitHub access token (required) + -version + Print version ``` -- List forked repos older than `n` days. By default, it'll fetch all repositories that - were forked at least 60 days ago. +- List forked repos older than `n` days. By default, it'll fetch all forked repositories + that were modified at least 60 days ago. The following command lists all forked + repositories. ```sh - fork-sweeper --owner rednafi --token $GITHUB_TOKEN --older-than-days 60 + fork-sweeper --owner rednafi --token $GITHUB_TOKEN --older-than-days 0 + ``` + + This returns: + + ```txt + Fetching forked repositories for rednafi... + + Guarded forked repos [won't be deleted]: + + Unguarded forked repos [will be deleted]: + - https://github.com/rednafi/cpython + - https://github.com/rednafi/dysconfig + - https://github.com/rednafi/pydantic ``` - The CLI won't delete any repository unless you explicitly tell it to do so with the @@ -79,7 +95,26 @@ Remove unused GitHub forks fork-sweeper --owner rednafi --token $GITHUB_TOKEN --delete ``` -- By default, the CLI will fetch 100 pages of forked repositories with 100 entries in each +- You can explicitly protect some repositories from deletion with the `--guard` parameter: + + ```sh + fork-sweeper --owner "rednafi" --token $GITHUB_TOKEN --older-than-days 0 --guard 'py' + ``` + + This prints: + + ```txt + Fetching forked repositories for rednafi... + + Guarded forked repos [won't be deleted]: + - https://github.com/rednafi/cpython + - https://github.com/rednafi/pydantic + + Unguarded forked repos [will be deleted]: + - https://github.com/rednafi/dysconfig + ``` + +- By default, the CLI will fetch 100 pages of forked repositories with 100 entries on each page. If you need more, you can set the page number as follows: ```sh