From 2fb4754fcc21d1c605a1b6ab50825b6331cc18df Mon Sep 17 00:00:00 2001 From: Sandor Semsey Date: Thu, 16 Oct 2025 00:05:35 +0200 Subject: [PATCH 1/3] lib/git: ghub-get ignore case on sort --- lib/github.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/github.sh b/lib/github.sh index 5e7fe12..8379c16 100644 --- a/lib/github.sh +++ b/lib/github.sh @@ -25,7 +25,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 From ace1b9dc1b32c9618edaf80e69382887fc2975aa Mon Sep 17 00:00:00 2001 From: Sandor Semsey Date: Thu, 16 Oct 2025 00:13:41 +0200 Subject: [PATCH 2/3] lib/git: add ghub-list-license --- docs/lib/github.md | 16 ++++++++++++++++ lib/github.sh | 14 ++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/docs/lib/github.md b/docs/lib/github.md index 3128829..a431f5b 100644 --- a/docs/lib/github.md +++ b/docs/lib/github.md @@ -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. diff --git a/lib/github.sh b/lib/github.sh index 8379c16..c04e51b 100644 --- a/lib/github.sh +++ b/lib/github.sh @@ -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) From d8e544de44e703a47bbee217e57d843384006e77 Mon Sep 17 00:00:00 2001 From: Sandor Semsey Date: Thu, 16 Oct 2025 00:17:08 +0200 Subject: [PATCH 3/3] docs/lib/git: update optional params --- docs/lib/git.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/lib/git.md b/docs/lib/git.md index 3fb375b..5503e64 100644 --- a/docs/lib/git.md +++ b/docs/lib/git.md @@ -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. ``` @@ -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'. ``` @@ -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'. ```