gh-plugin-org

2.5.2 • Public • Published

gh-org

Synopsis

A plugin for gh to manage GitHub organizations

Installation

npm i -g gh-plugin-org

or if you prefer to install it locally:

npm i gh-plugin-org

Usage

$ npx gh-org
Usage: gh-org [options] [command]

Options:
  -V, --version   output the version number
  -h, --help      display help for command

Commands:
  cd              Set your organization to use as default
  list            Lists the information within the organization
  create          Create information within the organization
  help [command]  display help for command

Adding as an alias to gh

Install gh-cli. Follow th instructions in GitHub CLI README.md

When gh-org is installed globally you can do the alias this way:

✗ gh alias set --shell org 'gh-org $@' 
- Adding alias for org: gh-org $@
✓ Added alias.

Or if installed locally:

✗ gh alias set --shell org 'npx gh-org $@' 
- Adding alias for org: npx gh-org $@
✓ Added alias.

Then you can use it as:

$ gh org list people --outside-collaborators
User: alu21901
Github url: https://github.com/alu21901
User: aluBN11
Github url: https://github.com/aluBN11
User: Angred19
Github url: https://github.com/Angred19
User: carlos016
Github url: https://github.com/carlos016
User: coromoto
Github url: https://github.com/coromoto

Command cd

[test-package(master)]$ npx gh-org cd ULL-ESIT-PL-2021

Currently, creates a file org.jsonin the current folder:

[test-package(master)]$ cat org.json
{"organizationDefault":"ULL-ESIT-PL-2021"}[~/campus-virtual/2021/tfg2021/TFG2021_Jos

Command Create

The create command creates information about our organization

$ npx gh-org create --help
Usage: create [options] [command]

Options:
  -h, --help      display help for command

Commands:
  superrepo       Create a repo containing all the organization's repos in
                  submodules.
  repo            Create a repo within the organization.

  help [command]  display help for command

Subcommnad Superrepo

The superrepo, create a repo within the default organization where it includes as submodules the other repositories in the same organization. The --pattern option supports regular expressions with which to match.

$ npx gh-org create superrepo --help
Usage: superrepo [options] <repo>

Arguments:
  repo                            name of the new repo in the organization

Options:
  --pattern <regular-expression>  Include only those that match the regular expression
  -h, --help                      display help for command

- Example of use

$ node index.js list repo
List of repos in serah-org.
[1]:    dummy
[2]:    dummy2
[3]:    internal
[4]:    dummy3
[5]:    test1
[6]:    test2
[7]:    dummy4
[8]:    day3
[9]:    day3-2
[10]:   day3-3
[11]:   day3-4
[12]:   day3-5
[13]:   day3-6
[14]:   day3-7
[15]:   day3-8
[16]:   day3-9
[17]:   day3-10
[18]:   day4-1
[19]:   day5-1
[20]:   day5-2
$ npx gh-org create superrepo newRepo --pattern day5
Cloning into 'C:/Users/joser/Desktop/ULL/TFG/tfg-jose-ramon-rodriguez-hernandez/.gh/superrepo/newRepo1/day5-1'...
warning: LF will be replaced by CRLF in .gitmodules.
The file will have its original line endings in your working directory
Cloning into 'C:/Users/joser/Desktop/ULL/TFG/tfg-jose-ramon-rodriguez-hernandez/.gh/superrepo/newRepo1/day5-2'...
warning: LF will be replaced by CRLF in .gitmodules.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in .gitmodules.
The file will have its original line endings in your working directory
[master (root-commit) a408b3b] Submodules included
 3 files changed, 8 insertions(+)
 create mode 100644 .gitmodules
 create mode 160000 day5-1
 create mode 160000 day5-2
To github.com:serah-org/newRepo.git
 * [new branch]      master -> master

Subcommand Repo

The repo, Create a repo within the organization. By default, it will do so in the default organization. The --org option, allows you to select an organization.

$ npx gh-org create repo --help
Usage: repo [options] <repo>

Arguments:
  repo                  name of the new repo in the organization

Options:
  --org <organization>  Select the organization
  -h, --help            display help for command

- Example of use

$ npx gh-org create repo day2-09-08 --org serah-org
Created successfully

Command List

The list command displays information about our organization.

$ npx gh-org list --help
Usage: list [options] [command]
Options:
  -h, --help      display help for command

Commands:
  default         Default organization name
  repo            Lists the repositories
  people          Lists the people
  teams           Lists the teams
  overview        Summary of the organization
  help [command]  display help for command

Subcommand Default

The default, shows the name of the default organization within the org.json.

- Example of use

$ npx gh-org list default
Organization default:
        "serah-org"

Subcommand repo

The repo, displays a list of the organization's repositories by default. Additionally, the --pattern option supports regular expressions with which to match, the --org select another organization than the default one and --paginate collect all the repositories, being a slower call.

$npx gh-org list repo --help
Usage: repo [options]

Options:
  --pattern <regular-expression>  Include only those that match the regular expression
  --org <organization>            Select the organization
  --paginate                      Enable paginate request
  -h, --help                      display help for command

- Example of use

$ node index.js list repo --org serah-org
List of repos in serah-org.
[1]:    dummy
[2]:    dummy2
[3]:    internal
[4]:    dummy3
[5]:    test1
[6]:    test2
[7]:    dummy4
[8]:    day3
[9]:    day3-2
[10]:   day3-3
[11]:   day3-4
[12]:   day3-5
[13]:   day3-6
[14]:   day3-7
[15]:   day3-8
[16]:   day3-9
[17]:   day3-10
[18]:   day4-1
[19]:   day5-1
[20]:   day5-2

Subcommnad people

The people, shows the members within the organization. Additionally, the --outside-collaborators option displays the external collaborators.

$ npx gh-org list people --help
Usage: people [options]

Options:
--outside-collaborators  Show list of outside collaborators of organizations
by default
-h, --help               display help for command

- Example of use

$ npx gh-org list people
User: AiranSchez
Github url: https://github.com/AiranSchez
User: Serah73
Github url: https://github.com/Serah73
$ npx gh-org list people --outside-collaborators
User: AkaiBF
Github url: https://github.com/AkaiBF
 

Subcommand teams

The teams, shows the teams within the organization. Additionally, the --org selects the org by parameter instead of the default one. Also, a regular expression can be passed to filter the output.

$ npx gh-org list teams --help
Usage: teams [options]

Options:
  --pattern <regular-expression>  Include only those that match the regular
                                  expression
  --org <organization>            Select the organization
  -h, --help                      display help for command

- Example of use

$npx gh-org list teams --org serah-org
List of team in serah-org:
- [1]:  dummy
- [2]:  team1
- [3]:  team2

Subcommand overview

The overview, summary of the default organization, unless you use the option --org, then then you use the org by parameter

$ npx gh-org list overview --help
Usage: overview [options]

Options:
  --org <organization>  Select the organization
  -h, --help            display help for command

- Example of use

$ npx gh-org list overview --org serah-org

Overview of "serah-org"

- url: https://api.github.com/orgs/serah-org
- html url: https://github.com/serah-org
- Description: null

Readme

Keywords

none

Package Sidebar

Install

npm i gh-plugin-org

Weekly Downloads

0

Version

2.5.2

License

ISC

Unpacked Size

30.2 kB

Total Files

16

Last publish

Collaborators

  • crguezl
  • alu0100947496