Life hack for github-cli gh repo clone $(printf 'squidowl/halloy%.0s ' {1..2})
, i.e. clone into owner/repo directory, not just repo. #github
EDIT:
I wrote a small #bash (obviously works also for #zsh) function to make cloning easier in my environment:
gh-repo-work() {
local url=$1
# Strip path from URL:
local url_path=${url#*\.*/}
# Clone to the Github tree:
gh repo clone $url_path "$HOME/work/github/$url_path"
}
“Demo”:
~ main*
❯ gh-repo-work m4b/goblin
Cloning into '/Users/jarkko/work/github/m4b/goblin'...
remote: Enumerating objects: 7261, done.
remote: Counting objects: 100% (1215/1215), done.
remote: Compressing objects: 100% (326/326), done.
remote: Total 7261 (delta 977), reused 922 (delta 889), pack-reused 6046
Receiving objects: 100% (7261/7261), 3.22 MiB | 4.69 MiB/s, done.
Resolving deltas: 100% (5565/5565), done.
~ main*
❯ ls -1 work/github/m4b/goblin
CHANGELOG.md
Cargo.toml
LICENSE
Makefile
README.md
assets
etc
examples
fuzz
fuzz-afl
src
tests
~ main*
❯ rm -rf work/github/m4b/goblin
~ main*
❯ gh-repo-work https://github.com/m4b/goblin
Cloning into '/Users/jarkko/work/github/m4b/goblin'...
remote: Enumerating objects: 7261, done.
remote: Counting objects: 100% (1227/1227), done.
remote: Compressing objects: 100% (337/337), done.
remote: Total 7261 (delta 988), reused 923 (delta 890), pack-reused 6034
Receiving objects: 100% (7261/7261), 3.23 MiB | 6.68 MiB/s, done.
Resolving deltas: 100% (5564/5564), done.
~ main*
❯ ls -1 work/github/m4b/goblin
CHANGELOG.md
Cargo.toml
LICENSE
Makefile
README.md
assets
etc
examples
fuzz
fuzz-afl
src
tests