From 5885fa010cd4f0738c4f2b7c0bb534528af5961b Mon Sep 17 00:00:00 2001 From: Jay Gabriels Date: Sun, 31 Jul 2022 10:21:31 -0700 Subject: [PATCH] update examples --- README.md | 5 ++++ examples/bitbucket.md | 26 +++++++++---------- examples/gitea.md | 26 +++++++++---------- examples/github.md | 50 ++++++++++++++++++------------------- examples/gitlab.md | 58 +++++++++++++++++++++---------------------- 5 files changed, 85 insertions(+), 80 deletions(-) diff --git a/README.md b/README.md index 2846e8d..7017a2e 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ go get github.com/gabrie30/ghorg ### github setup 1. Create [Personal Access Token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) with all `repo` scopes. Update `GHORG_GITHUB_TOKEN` in your `ghorg/conf.yaml` or as a cli flag. If your org has Saml SSO in front you will need to give your token those permissions as well, see [this doc](https://docs.github.com/en/github/authenticating-to-github/authenticating-with-saml-single-sign-on/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on). 1. For cloning GitHub Enterprise repos you must set `--base-url` e.g. `ghorg clone --base-url=https://internal.github.com` +1. See [examples/github.md](https://github.com/gabrie30/ghorg/blob/master/examples/github.md) on how to run ### gitlab setup @@ -149,6 +150,7 @@ $ ghorg clone fdroid --scm=gitlab --token=XXXX --preserve-dir 1. Create [Access Token](https://docs.gitea.io/en-us/api-usage/) (Settings -> Applications -> Generate Token) 1. Update `GHORG_GITEA_TOKEN` in your `ghorg/conf.yaml` or use the (--token, -t) flag. 1. Update `GHORG_SCM_TYPE` to `gitea` in your `ghorg/conf.yaml` or via cli flags +1. See [examples/gitea.md](https://github.com/gabrie30/ghorg/blob/master/examples/gitea.md) on how to run ### bitbucket setup @@ -156,12 +158,15 @@ $ ghorg clone fdroid --scm=gitlab --token=XXXX --preserve-dir 1. To configure with bitbucket you will need to create a new [app password](https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html) and update your `$HOME/.config/ghorg/conf.yaml` or use the (--token, -t) and (--bitbucket-username) flags. 1. Update [SCM type](https://github.com/gabrie30/ghorg/blob/master/sample-conf.yaml#L54-L57) to `bitbucket` in your `ghorg/conf.yaml` or via cli flags +1. See [examples/bitbucket.md](https://github.com/gabrie30/ghorg/blob/master/examples/bitbucket.md) on how to run #### PAT/OAuth token 1. Create a [PAT](https://confluence.atlassian.com/bitbucketserver/personal-access-tokens-939515499.html) 1. Set the token with `GHORG_BITBUCKET_OAUTH_TOKEN` in your `$HOME/.config/ghorg/conf.yaml` or using the `--token` flag. Make sure you do not have `--bitbucket-username` set. 1. Update SCM TYPE to `bitbucket` in your `ghorg/conf.yaml` or via cli flags +1. See [examples/bitbucket.md](https://github.com/gabrie30/ghorg/blob/master/examples/bitbucket.md) on how to run + ## How to Use diff --git a/examples/bitbucket.md b/examples/bitbucket.md index c61194b..101ad55 100644 --- a/examples/bitbucket.md +++ b/examples/bitbucket.md @@ -1,25 +1,25 @@ # Bitbucket Examples -> Note: all command line arguments can be set in your $HOME/.config/ghorg/conf.yaml +> Note: all command line arguments can be set in your $HOME/.config/ghorg/conf.yaml for more information see the [configuration](https://github.com/gabrie30/ghorg#configuration) section of the readme ## Bitbucket Cloud -Clone the microsoft workspace using an app-password +1. Clone the microsoft workspace using an app-password -``` -ghorg clone microsoft --scm=bitbucket --bitbucket-username= --token= -``` + ``` + ghorg clone microsoft --scm=bitbucket --bitbucket-username= --token= + ``` -Clone the microsoft workspace using oauth token +1. Clone the microsoft workspace using oauth token -``` -ghorg clone microsoft --scm=bitbucket --token= -``` + ``` + ghorg clone microsoft --scm=bitbucket --token= + ``` ## Hosted Bitbucket -Clone a workspace on a hosted bitbucket instance using an app-password +1. Clone a workspace on a hosted bitbucket instance using an app-password -``` -ghorg clone --scm=bitbucket --bitbucket-username= --token= --base-url=https:///v2 -``` + ``` + ghorg clone --scm=bitbucket --bitbucket-username= --token= --base-url=https:///v2 + ``` diff --git a/examples/gitea.md b/examples/gitea.md index d04766e..55f8d08 100644 --- a/examples/gitea.md +++ b/examples/gitea.md @@ -1,21 +1,21 @@ # Gitea Examples -> Note: all command line arguments can be set in your $HOME/.config/ghorg/conf.yaml +> Note: all command line arguments can be set in your $HOME/.config/ghorg/conf.yaml for more information see the [configuration](https://github.com/gabrie30/ghorg#configuration) section of the readme -clone an **org** +1. Clone an **org** -``` -ghorg clone --base-url=https://.com --token=XXXXXXX -``` + ``` + ghorg clone --base-url=https://.com --token=XXXXXXX + ``` -clone a **users** repos +1. Clone a **users** repos -``` -ghorg clone --clone-type=user --base-url=https://.com --token=bGVhdmUgYSBjb21tZW50IG9uIGlzc3VlIDY2 -``` + ``` + ghorg clone --clone-type=user --base-url=https://.com --token=bGVhdmUgYSBjb21tZW50IG9uIGlzc3VlIDY2 + ``` -clone all repos from a **github org** that are **prefixed** with "frontend" **into a folder** called "design_only" +1. Clone all repos from a **github org** that are **prefixed** with "frontend" **into a folder** called "design_only" -``` -ghorg clone --match-regex=^frontend --output-dir=design_only --base-url=https://.com --token=XXXXXXX -``` + ``` + ghorg clone --match-regex=^frontend --output-dir=design_only --base-url=https://.com --token=XXXXXXX + ``` diff --git a/examples/github.md b/examples/github.md index 9315068..7cee862 100644 --- a/examples/github.md +++ b/examples/github.md @@ -1,43 +1,43 @@ # GitHub Examples -> Note: all command line arguments can be set in your $HOME/.config/ghorg/conf.yaml +> Note: all command line arguments can be set in your $HOME/.config/ghorg/conf.yaml for more information see the [configuration](https://github.com/gabrie30/ghorg#configuration) section of the readme ## GitHub Cloud -clone an **org**, using a token on the commandline +1. Clone an **org**, using a token on the commandline -``` -ghorg clone --token=XXXXXX -``` + ``` + ghorg clone --token=XXXXXX + ``` -clone all repos from a **github org** that are **prefixed** with "frontend" **into a folder** called "design_only", assumes ghorg conf.yaml is setup with a token +1. Clone all repos from a **github org** that are **prefixed** with "frontend" **into a folder** called "design_only", assumes ghorg conf.yaml is setup with a token -``` -ghorg clone --match-regex=^frontend --output-dir=design_only --token=XXXXXX -``` + ``` + ghorg clone --match-regex=^frontend --output-dir=design_only --token=XXXXXX + ``` -clone a **users** repos, assumes ghorg conf.yaml is setup with a token +1. Clone a **users** repos, assumes ghorg conf.yaml is setup with a token -``` -ghorg clone --clone-type=user --token=bGVhdmUgYSBjb21tZW50IG9uIGlzc3VlIDY2 -``` + ``` + ghorg clone --clone-type=user --token=bGVhdmUgYSBjb21tZW50IG9uIGlzc3VlIDY2 + ``` ## GitHub Enterprise -clone an **org** +1. Clone an **org** -``` -ghorg clone --base-url=https://.com --token=XXXXXX -``` + ``` + ghorg clone --base-url=https://.com --token=XXXXXX + ``` -clone all repos from a **github org** that are **prefixed** with "frontend" **into a folder** called "design_only" +1. Clone all repos from a **github org** that are **prefixed** with "frontend" **into a folder** called "design_only" -``` -ghorg clone --match-regex=^frontend --output-dir=design_only --base-url=https://.com --token=XXXXXX -``` + ``` + ghorg clone --match-regex=^frontend --output-dir=design_only --base-url=https://.com --token=XXXXXX + ``` -clone a **users** repos +1. Clone a **users** repos -``` -ghorg clone --clone-type=user --base-url=https://.com --token=XXXXXX -``` + ``` + ghorg clone --clone-type=user --base-url=https://.com --token=XXXXXX + ``` diff --git a/examples/gitlab.md b/examples/gitlab.md index c181663..cd5aafa 100644 --- a/examples/gitlab.md +++ b/examples/gitlab.md @@ -1,54 +1,54 @@ # GitLab Examples -> Note: all command line arguments can be set in your $HOME/.config/ghorg/conf.yaml +> Note: all command line arguments can be set in your $HOME/.config/ghorg/conf.yaml for more information see the [configuration](https://github.com/gabrie30/ghorg#configuration) section of the readme ## Hosted GitLab Instances **Note: "all-groups" only works on hosted GitLab instances running 13.0.1 or greater** -clone all groups on a **hosted gitlab** instance **preserving** the directory structure of subgroups +1. Clone all groups on a **hosted gitlab** instance **preserving** the directory structure of subgroups -``` -ghorg clone all-groups --base-url=https:// --scm=gitlab --token=XXXXXX --preserve-dir -``` + ``` + ghorg clone all-groups --base-url=https:// --scm=gitlab --token=XXXXXX --preserve-dir + ``` -clone a **user** on a **hosted gitlab** instance using a **token** for auth +1. Clone a **user** on a **hosted gitlab** instance using a **token** for auth -``` -ghorg clone --clone-type=user --base-url=https:// --scm=gitlab --token=bGVhdmUgYSBjb21tZW50IG9uIGlzc3VlIDY2 -``` + ``` + ghorg clone --clone-type=user --base-url=https:// --scm=gitlab --token=bGVhdmUgYSBjb21tZW50IG9uIGlzc3VlIDY2 + ``` -clone a **group** on a **hosted gitlab** instance **preserving** the directory structure of subgroups +1. Clone a **group** on a **hosted gitlab** instance **preserving** the directory structure of subgroups -``` -ghorg clone --base-url=https:// --scm=gitlab --preserve-dir -``` + ``` + ghorg clone --base-url=https:// --scm=gitlab --preserve-dir + ``` -clone only a **subgroup** on a **hosted gitlab** +1. Clone only a **subgroup** on a **hosted gitlab** -``` -ghorg clone / --base-url=https:// --scm=gitlab -``` + ``` + ghorg clone / --base-url=https:// --scm=gitlab + ``` -clone all repos that are **prefixed** with "frontend" **into a folder** called "design_only" from a **group** on a **hosted gitlab** instance +1. clone all repos that are **prefixed** with "frontend" **into a folder** called "design_only" from a **group** on a **hosted gitlab** instance -``` -ghorg clone --base-url=https:// --scm=gitlab --match-regex=^frontend --output-dir=design_only -``` + ``` + ghorg clone --base-url=https:// --scm=gitlab --match-regex=^frontend --output-dir=design_only + ``` ## Cloud GitLab Orgs eg. https://gitlab.com/gitlab-examples -clone all groups **preserving** the directory structure of subgroups +1. clone all groups **preserving** the directory structure of subgroups -``` -ghorg clone gitlab-examples --scm=gitlab --token=XXXXXX --preserve-dir -``` + ``` + ghorg clone gitlab-examples --scm=gitlab --token=XXXXXX --preserve-dir + ``` -clone only a **subgroup** +1. clone only a **subgroup** -``` -ghorg clone gitlab-examples/wayne-enterprises --scm=gitlab --token=XXXXXX -``` + ``` + ghorg clone gitlab-examples/wayne-enterprises --scm=gitlab --token=XXXXXX + ```