Created
December 31, 2024 11:15
-
-
Save imgnx/575a6a643f90738fde20b8f2d639eeca to your computer and use it in GitHub Desktop.
Have you ever been creating a repo and you're writing your package.json file, but then you realize you should create a repo first, and then you have to move your hand all the way to your mouse to copy the URL? Well, so have I, and here's a fix for that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh -df | |
# Et voila! | |
# No more typing in the same repository owner/repo twice after running | |
#`gh repo create` | |
function copy_that_last_repo_address() { | |
if ! command -v gh &>/dev/null; then | |
echo "gh command not found. Please install GitHub CLI." | |
return 1 | |
fi | |
local repo_addr=$(gh repo list | awk '{print $1; exit}') | |
echo "Copied: $repo_addr" | |
echo $repo_addr | pbcopy | |
} | |
alias ctlra=copy_that_last_repo_address | |
# Author: Donald Wayne Moore Jr. [@imgnx(tion)] | |
# License: 0BSD | |
# Copyright (c) 2024 IMG Funnels, LLC. All rights reserved. | |
# © Donald Moore <http://©.st/imgnx> | |
# SPDX-License-Identifier: 0BSD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment