Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/lib/git.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ Rebase source branch onto target branch and forcefully push the rebased branch t
**Usage**

```
ggit-base SOURCE [TARGET] [REMOTE]
ggit-base [SOURCE] [TARGET] [REMOTE]
ggit-base SOURCE... TARGET REMOTE

Params:
SOURCE Branch to be rebased
SOURCE Branch to be rebased. Defaults to current branch in the first form.
TARGET Rebase onto this branch. Defaults to 'main' in the first form.
REMOTE Remote repository to pull and push. Defaults to 'origin' in the first form.
```
Expand Down Expand Up @@ -79,10 +79,10 @@ Merge the source branch into the target branch (performs a fast-forward merge).
**Usage**

```
ggit-merge SOURCE [TARGET] [REMOTE]
ggit-merge [SOURCE] [TARGET] [REMOTE]

Params:
SOURCE Branch to be merged
SOURCE Branch to be merged. Defaults to current branch.
TARGET Branch to merge into. Defaults to 'main'.
REMOTE Remote repository to pull and push. Defaults to 'origin'.
```
Expand Down Expand Up @@ -210,10 +210,10 @@ This way you can have the same commits (and history) as remote.
**Usage**

```
ggit-update BRANCH [REMOTE]
ggit-update [BRANCH] [REMOTE]

Params:
BRANCH Branch to update
BRANCH Branch to update. Defaults to current branch.
REMOTE Remote repository, defaults to 'origin'.
```

Expand Down
16 changes: 16 additions & 0 deletions docs/lib/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,22 @@ EXTRA Optional extra params to 'gh'

---

## ghub-list-license

List repositories for a GitHub account with license info.

**Usage**

```
ghub-list-license OWNER [EXTRA]...

Params:
OWNER Owner, GitHub user or organization
EXTRA Optional extra params to 'gh'
```

---

## ghub-open

Open GitHub repository page in web browser.
Expand Down
18 changes: 17 additions & 1 deletion lib/github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ ghub-list() {
gh repo list "${owner}" --limit 100 "${@}"
}

## List repos with license info
##
## @param $1 Owner (account)
## @param $@ Extra args to gh
#################################
ghub-list-license() {
local owner="${1?:Owner missing}"
shift
# shellcheck disable=SC2016
ghub-list "${owner}" "${@}" \
--json nameWithOwner,description,licenseInfo,visibility \
--template '{{ tablerow ("NAME" | color "yellow+du") ("DESCRIPTION" | color "yellow+du") ("LICENSE" | color "yellow+du") ("VISIBILITY" | color "yellow+du") }}{{ range . }}{{ $lic := "---" }}{{ with .licenseInfo }}{{ $lic = .name }}{{ end }}{{ tablerow .nameWithOwner .description $lic .visibility }}{{ end }}'
}

## Get repo names
##
## @param $1 Owner (account)
Expand All @@ -25,7 +39,9 @@ ghub-get() {
local owner="${1?:Owner missing}"
shift
# shellcheck disable=SC2312
gh repo list "${owner}" --limit 100 --json nameWithOwner --jq ".[].nameWithOwner" "${@}" | LC_COLLATE=C sort
ghub-list "${owner}" "${@}" \
--json nameWithOwner \
--jq '.[].nameWithOwner' | LC_COLLATE=C sort -f
}

## Open repo in browser
Expand Down