Skip to content

Commit

Permalink
Fix examples command (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrie30 authored Aug 26, 2023
1 parent 8260963 commit 50de2cf
Show file tree
Hide file tree
Showing 10 changed files with 454 additions and 4 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/examples-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Check Examples Copy Folder Content

on:
pull_request:

jobs:
check-folders:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Compare folders
run: |
shopt -s dotglob
if ! diff -r examples/ cmd/examples-copy; then
echo "Examples folder is not up to date. Please run 'make examples' and commit the changes."
exit 1
fi
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

## [1.9.9] - 8/26/23
### Added
### Changed
### Deprecated
### Removed
### Fixed
- Examples command; thanks @vlcinsky
### Security

## [1.9.8] - 8/25/23
### Added
- Examples command; thanks @MaxG87
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ fmt:
.PHONY: release
release:
goreleaser release


.PHONY: examples
examples:
cp -rf examples/* cmd/examples-copy/
32 changes: 32 additions & 0 deletions cmd/examples-copy/after_cloning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# After Cloning

A few ways to use ghorg after cloning repos. Please add yours below if you have one!

## On Mac

> Dump all test.sh files from ghorg dir into a results file
```
find $HOME/ghorg -name "test.sh" -exec cat {} \; > results
```

> Find any use of gcloud in a file called test.sh
```
find $HOME/ghorg -name "test.sh" | xargs grep -i "gcloud"
```

> Sort cloned repos by size
```
# cd into a clone dir
du -d 1 . | sort -nr | cut -f2- | xargs du -hs
```

## On PC

> Help Wanted
## On Linux

> Help Wanted
27 changes: 27 additions & 0 deletions cmd/examples-copy/bitbucket.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Bitbucket Examples

> Note: all command line arguments can be permanently set in your `$HOME/.config/ghorg/conf.yaml` for more information see the [configuration](https://github.com/gabrie30/ghorg#configuration) section of the README.md.
To view all additional flags see the [sample-conf.yaml](https://github.com/gabrie30/ghorg/blob/master/sample-conf.yaml) or use `ghorg clone --help`

## Bitbucket Cloud

1. Clone the microsoft workspace using an app-password

```
ghorg clone microsoft --scm=bitbucket --bitbucket-username=<your-username> --token=<app-password>
```
1. Clone the microsoft workspace using oauth token
```
ghorg clone microsoft --scm=bitbucket --token=<oauth-token>
```
## Hosted Bitbucket
1. Clone a workspace on a hosted bitbucket instance using an app-password
```
ghorg clone <workspace> --scm=bitbucket --bitbucket-username=<your-username> --token=<app-password> --base-url=https://<api.myhostedbb.com>/v2
```
23 changes: 23 additions & 0 deletions cmd/examples-copy/gitea.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Gitea Examples

> Note: all command line arguments can be permanently set in your `$HOME/.config/ghorg/conf.yaml` for more information see the [configuration](https://github.com/gabrie30/ghorg#configuration) section of the README.md.
To view all additional flags see the [sample-conf.yaml](https://github.com/gabrie30/ghorg/blob/master/sample-conf.yaml) or use `ghorg clone --help`

1. Clone an **org**

```
ghorg clone <gitea_org> --base-url=https://<your-internal-gitea>.com --token=XXXXXXX
```
1. Clone a **users** repos
```
ghorg clone <gitea_username> --clone-type=user --base-url=https://<your-internal-gitea>.com --token=bGVhdmUgYSBjb21tZW50IG9uIGlzc3VlIDY2
```
1. Clone all repos from a **gitea org** that are **prefixed** with "frontend" **into a folder** called "design_only"
```
ghorg clone <gitea_org> --match-regex=^frontend --output-dir=design_only --base-url=https://<your-internal-gitea>.com --token=XXXXXXX
```
45 changes: 45 additions & 0 deletions cmd/examples-copy/github.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# GitHub Examples

> Note: all command line arguments can be permanently set in your `$HOME/.config/ghorg/conf.yaml` for more information see the [configuration](https://github.com/gabrie30/ghorg#configuration) section of the README.md.
To view all additional flags see the [sample-conf.yaml](https://github.com/gabrie30/ghorg/blob/master/sample-conf.yaml) or use `ghorg clone --help`

## GitHub Cloud

1. Clone an **org**, using a token on the commandline

```
ghorg clone <github_org> --token=XXXXXX
```
1. Clone all repos from a **github org** that are **prefixed** with "frontend" **into a folder** called "design_only"
```
ghorg clone <github_org> --match-regex=^frontend --output-dir=design_only --token=XXXXXX
```
1. Clone a **users** repos, assumes ghorg conf.yaml is setup with a token
```
ghorg clone <github_username> --clone-type=user --token=bGVhdmUgYSBjb21tZW50IG9uIGlzc3VlIDY2
```
## GitHub Enterprise
1. Clone an **org**
```
ghorg clone <github_org> --base-url=https://<your-hosted-github>.com --token=XXXXXX
```
1. Clone all repos from a **github org** that are **prefixed** with "frontend" **into a folder** called "design_only"
```
ghorg clone <github_org> --match-regex=^frontend --output-dir=design_only --base-url=https://<your-hosted-github>.com --token=XXXXXX
```
1. Clone a **users** repos
```
ghorg clone <github_username> --clone-type=user --base-url=https://<your-hosted-github>.com --token=XXXXXX
```
Loading

0 comments on commit 50de2cf

Please sign in to comment.