diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml new file mode 100644 index 0000000..9c24e0c --- /dev/null +++ b/.github/workflows/mkdocs.yml @@ -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 diff --git a/cmd/collect_github_repos.go b/cmd/collect_github_repos.go new file mode 100644 index 0000000..d6cf5af --- /dev/null +++ b/cmd/collect_github_repos.go @@ -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) +} diff --git a/docs/README.md b/docs/index.md similarity index 84% rename from docs/README.md rename to docs/index.md index 4151a29..8ec50b0 100644 --- a/docs/README.md +++ b/docs/index.md @@ -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. diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..b22daf7 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,4 @@ +site_name: Borg Data Collector +repo_url: https://github.com/Snider/Borg +theme: + name: material