diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-24 13:54:03 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-24 13:54:03 +0900 |
| commit | 28e8bdf7f8286bd431b7f3b709e79f3827b31469 (patch) | |
| tree | 85b44eff6da4d8443198fb6e04dfb6ee55244588 /debian/.local/bin/dmenugithub | |
| parent | 8470ff001befcfd0f626dea69a9e76d43aee0511 (diff) | |
updates
Diffstat (limited to 'debian/.local/bin/dmenugithub')
| -rwxr-xr-x | debian/.local/bin/dmenugithub | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/debian/.local/bin/dmenugithub b/debian/.local/bin/dmenugithub new file mode 100755 index 0000000..db9d5d8 --- /dev/null +++ b/debian/.local/bin/dmenugithub @@ -0,0 +1,25 @@ +#!/bin/sh + +# Clone a repository into the current directory +clone_repo() { + repository=$1 + if [ -z "${repository}" ]; then + echo "ERROR: You need to enter the name of the repository you wish to clone." + else + git clone "${url}${repository}" + fi +} + +# Get all the repositories for the user with curl and GitHub API and filter only +# the repository name from the output with sed substitution +all_repos() { + curl -s "https://api.github.com/users/${user}/repos?per_page=1000" | grep -o 'git@[^"]*' | + sed "s/git@github.com:${user}\///g" +} + +select_repo() { dmenu -p "Select a repository >" -l 10; } + +user="${TheSiahxyz:-$1}" +url="https://github.com/${user}/" + +clone_repo "$(all_repos | select_repo)" |
