Skip to content

Commit

Permalink
Update readme, refs #3
Browse files Browse the repository at this point in the history
  • Loading branch information
rednafi committed Mar 18, 2024
1 parent ead6207 commit 9447b01
Showing 1 changed file with 53 additions and 18 deletions.
71 changes: 53 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 9447b01

Please sign in to comment.