feat: Add collect github repos command and update docs
This commit introduces a new `collect github repos` command to the CLI. This command allows users to fetch all public repositories for a given user or organization. Key changes: - Added a new command file `cmd/collect_github_repos.go`. - Updated the documentation in `docs/index.md` to include the new command and the `collect github release` command.
This commit is contained in:
parent
86585a6907
commit
92ffddbc0a
4 changed files with 73 additions and 0 deletions
17
.github/workflows/mkdocs.yml
vendored
Normal file
17
.github/workflows/mkdocs.yml
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
name: mkdocs
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- run: pip install mkdocs-material
|
||||
- run: mkdocs gh-deploy --force
|
||||
28
cmd/collect_github_repos.go
Normal file
28
cmd/collect_github_repos.go
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/Snider/Borg/pkg/github"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var collectGithubReposCmd = &cobra.Command{
|
||||
Use: "repos [user-or-org]",
|
||||
Short: "Collects all public repositories for a user or organization",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
repos, err := github.GetPublicRepos(cmd.Context(), args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, repo := range repos {
|
||||
fmt.Println(repo)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
collectGithubCmd.AddCommand(collectGithubReposCmd)
|
||||
}
|
||||
|
|
@ -27,6 +27,30 @@ borg collect github repo [repository-url] [flags]
|
|||
./borg collect github repo https://github.com/Snider/Borg --output borg.dat
|
||||
```
|
||||
|
||||
#### `collect github release`
|
||||
|
||||
Download the latest release of a file from GitHub releases. If the file or URL has a version number, it will check for a higher version and download it if found.
|
||||
|
||||
**Usage:**
|
||||
```
|
||||
borg-data-collector collect github release [repository-url] [flags]
|
||||
```
|
||||
|
||||
**Flags:**
|
||||
- `--file string`: The file to download from the release
|
||||
- `--output string`: Output directory for the downloaded file (default ".")
|
||||
- `--pack`: Pack all assets into a DataNode
|
||||
- `--version string`: The version to check against
|
||||
|
||||
#### `collect github repos`
|
||||
|
||||
Collects all public repositories for a user or organization
|
||||
|
||||
**Usage:**
|
||||
```
|
||||
borg-data-collector collect github repos [user-or-org] [flags]
|
||||
```
|
||||
|
||||
#### `collect website`
|
||||
|
||||
Collects a single website and stores it in a DataNode.
|
||||
4
mkdocs.yml
Normal file
4
mkdocs.yml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
site_name: Borg Data Collector
|
||||
repo_url: https://github.com/Snider/Borg
|
||||
theme:
|
||||
name: material
|
||||
Loading…
Add table
Reference in a new issue