Speed Up GitHub CLI: Custom Completion for 'gh repo clone' Command
Learn how to supercharge your GitHub CLI experience with custom bash completion for the 'gh repo clone' command. Includes step-by-step setup and practical examples.
From 4411eda7388f185ea2283914ca228ef34f7400f4 Mon Sep 17 00:00:00 2001 From: "Chris K.Y. FUNG" <8746768+chriskyfung@users.noreply.github.com> Date: Sat, 28 Dec 2024 11:36:42 +0800 Subject: [PATCH] Updates --- ...rom-a-LAMMPS-Simulation-to-Your-Email.html | 2 +- ...or-visual-comparison-of-journal-ranks.html | 2 +- ...A-Folder-Based-On-The-Input-Variables.html | 2 +- ...ference-paper-is-now-available-online.html | 2 +- .../12/My-trip-of-AEPA-2014-conference.html | 2 +- ...in-the-postgraduate-or-research-study.html | 2 +- ...on-Tool-Version-261-has-been-released.html | 2 +- .../11/27/template-OVITO-python-modifier.html | 2 +- .../01/18/Installation-of-Andriod-Studio.html | 2 +- blog/2017/02/26/new-site-is-opened.html | 2 +- blog/2019/10/22/Follow-Me-on-Medium.html | 2 +- blog/2020/06/01/enjoy-our-new-theme.html | 2 +- blog/amp-now.html | 2 +- blog/comp-sci/fuzzy-logic.html | 2 +- .../index.html | 64 ++++++++++++++++++ blog/index.html | 2 +- ...tall-Chrome-Remote-Desktop-on-Kubuntu.html | 2 +- blog/linux/Useful-Ubuntu-Commands.html | 2 +- ...t-MATLAB-Matrix-to-MS-Office-Equation.html | 2 +- blog/matlab/Working-MATLAB-with-MS-Excel.html | 2 +- blog/matlab/expand-twitter-short-url.html | 2 +- .../file-io-and-file-system-in-matlab.html | 2 +- .../matlab/matlab-packages-and-toolboxes.html | 2 +- ...-with-Contact-Center-AI-Challenge-Lab.html | 2 +- ...Website-on-Google-Cloud-Challenge-Lab.html | 2 +- ...-Docker-Image-to-a-Kubernetes-Cluster.html | 2 +- ...Manage-APIs-with-Apigee-Challenge-Lab.html | 2 +- ...etworks-in-Google-Cloud-Challenge-Lab.html | 2 +- ...ws-Bastion-Host-with-Terraform-on-GCP.html | 2 +- ...tartup-Script-with-Deployment-Manager.html | 2 +- .../qwiklabs/Controlling-Your-Costs-Quiz.html | 2 +- ...Instance-with-a-Remote-Startup-Script.html | 2 +- ...ments-with-Google-Cloud-Challenge-Lab.html | 2 +- ...ernetes-in-Google-Cloud-Challenge-Lab.html | 2 +- ...er-Data-in-Google-Cloud-Challenge-Lab.html | 2 +- ...els-with-Explainable-AI-Challenge-Lab.html | 2 +- ...-Manage_Cloud_Resources-Challenge-Lab.html | 2 +- ...-Cloud-Essential-Skills-Challenge-Lab.html | 2 +- ...-DevOps-in-Google-Cloud-Challenge-Lab.html | 2 +- ...from-Data-with-BigQuery-Challenge-Lab.html | 2 +- ...h-Machine-Learning-APIs-Challenge-Lab.html | 2 +- ...-a-MySQL-Database-to-Google-Cloud-SQL.html | 2 +- ...I-Tasks-in-Google-Cloud-Challenge-Lab.html | 2 +- ...e-Tasks-in-Google-Cloud-Challenge-Lab.html | 2 +- ...d-Application-on-a-Kubernetes-Cluster.html | 2 +- ...oogle-Kubernetes-Engine-Challenge-Lab.html | 2 +- ...ronment-in-Google-Cloud-Challenge-Lab.html | 2 +- ...e-Cloud-Platform-Commands-Cheat-Sheet.html | 2 +- ...ript-for-Labelling-Completed-Qwiklabs.html | 2 +- ...arehouses-with-bigquery-challenge-lab.html | 2 +- ...dentity-in-google-cloud-challenge-lab.html | 2 +- ...oogle-kubernetes-engine-challenge-lab.html | 2 +- .../qwiklab-completion-tracker-versions.html | 4 +- ...ps-for-learning-google-cloud-platform.html | 2 +- ...ss-firebase-development-challenge-lab.html | 2 +- .../qwiklabs/where-does-my-bear-badge-go.html | 2 +- ...-tricks-and-tools-for-tumblr-bloggers.html | 2 +- ...open-graph-image-tag-to-a-tumblr-blog.html | 2 +- ...10-store-app-path-for-default-program.html | 2 +- ...indows10-boot-loop-after-fail-upgrade.html | 2 +- category/academic/index.html | 2 +- category/announcement/index.html | 2 +- category/cloud/index.html | 2 +- category/computer-science/index.html | 2 +- category/developer-tools/index.html | 4 +- category/index.html | 2 +- category/linux/index.html | 2 +- category/project/index.html | 2 +- category/web-development/index.html | 2 +- category/windows/index.html | 2 +- feed.xml | 20 +++--- .../index.html | 63 +---------------- .../gh-repo-clone-custom-completion-cover.jpg | Bin ...po-clone-custom-completion-cover.thumb.jpg | Bin ...o-clone-custom-completion-cover.thumb.webp | Bin ...gh-repo-clone-custom-completion-cover.webp | Bin index.html | 2 +- log_cweb.log | 2 + privacy-policy.html | 2 +- redirects.json | 2 +- search.html | 2 +- sitemap.xml | 2 +- tag/android-studio/index.html | 2 +- tag/apigee/index.html | 2 +- tag/autocompletions/index.html | 4 +- tag/bash/index.html | 4 +- tag/bigquery/index.html | 2 +- tag/changelog/index.html | 2 +- tag/cloud-ai/index.html | 2 +- tag/cloud-function/index.html | 2 +- tag/command-line/index.html | 4 +- tag/computer-science/index.html | 2 +- tag/conference-paper/index.html | 2 +- tag/conference/index.html | 2 +- tag/custom-theme/index.html | 2 +- tag/data-science/index.html | 2 +- tag/docker/index.html | 2 +- tag/email/index.html | 2 +- tag/file-i-o/index.html | 2 +- tag/fuzzy-logic/index.html | 2 +- tag/gcloud/index.html | 2 +- tag/github-cli/index.html | 4 +- tag/google-cloud/index.html | 2 +- tag/how-to-research/index.html | 2 +- tag/index.html | 2 +- tag/jekyll/index.html | 2 +- tag/jenkins/index.html | 2 +- tag/journal-ranks/index.html | 2 +- tag/kde/index.html | 2 +- tag/kubernetes/index.html | 2 +- tag/lammps/index.html | 2 +- tag/learning-map/index.html | 2 +- tag/linux/index.html | 2 +- tag/logbook/index.html | 2 +- tag/machine-learning/index.html | 2 +- tag/matlab/index.html | 2 +- tag/medium/index.html | 2 +- tag/meta-tags/index.html | 2 +- tag/molecular-dynamics/index.html | 2 +- tag/ms-excel/index.html | 2 +- tag/ms-office/index.html | 2 +- tag/mysql/index.html | 2 +- tag/open-graph/index.html | 2 +- tag/ovito/index.html | 2 +- tag/python/index.html | 2 +- tag/qwiklabs/index.html | 2 +- tag/remote-desktop/index.html | 2 +- tag/research-tool/index.html | 2 +- tag/research/index.html | 2 +- tag/secure-vpc/index.html | 2 +- tag/shorthand/index.html | 2 +- tag/single-crystal-diamond/index.html | 2 +- tag/taiwan/index.html | 2 +- tag/ted/index.html | 2 +- tag/tensorflow/index.html | 2 +- tag/terraform/index.html | 2 +- tag/tumblr/index.html | 2 +- tag/twitter/index.html | 2 +- tag/ubuntu/index.html | 2 +- tag/user-tips/index.html | 2 +- tag/userscript/index.html | 2 +- tag/windows-10/index.html | 2 +- tag/windows-server/index.html | 2 +- tag/wordpress/index.html | 2 +- tag/wsl2/index.html | 2 +- 145 files changed, 221 insertions(+), 214 deletions(-) create mode 100644 blog/devtools/github-cli-repo-clone-custom-completion/index.html rename images/posts/{coding => devtools}/gh-repo-clone-custom-completion-cover.jpg (100%) rename images/posts/{coding => devtools}/gh-repo-clone-custom-completion-cover.thumb.jpg (100%) rename images/posts/{coding => devtools}/gh-repo-clone-custom-completion-cover.thumb.webp (100%) rename images/posts/{coding => devtools}/gh-repo-clone-custom-completion-cover.webp (100%) create mode 100644 log_cweb.log diff --git a/blog/2014/06/13/How-to-Send-a-Notification-from-a-LAMMPS-Simulation-to-Your-Email.html b/blog/2014/06/13/How-to-Send-a-Notification-from-a-LAMMPS-Simulation-to-Your-Email.html index ab027700b..585e4743b 100644 --- a/blog/2014/06/13/How-to-Send-a-Notification-from-a-LAMMPS-Simulation-to-Your-Email.html +++ b/blog/2014/06/13/How-to-Send-a-Notification-from-a-LAMMPS-Simulation-to-Your-Email.html @@ -25,7 +25,7 @@
-This website use cookies to help you have a superior and more relevant browsing experience on the website. Read more...
Ever found yourself typing gh repo clone
and struggling to remember repository names? I’ve been there. As a developer who works with dozens of repositories daily, I needed a better solution. That’s why I created a custom completion script that makes the GitHub CLI’s clone command more powerful and user-friendly.
While the standard gh repo clone
is incredibly useful, it lacks intelligent autocompletion. Here’s what you’re missing:
$ gh repo clone my<tab>
+my-awesome-project my-docker-images my-python-scripts
+
I struggled to recall exact repository names, some of which are a mouthful. Then there were the flags that I could never remember. These tiny hurdles added up, hindering productivity, especially for those who constantly work with multiple repositories.
Driven by the desire for seamless interaction, I embarked on a quest to enhance my command-line experience. Instead of wrestling with repository names and flags, I decided to create a custom completion script for the gh repo clone
command. The script enables:
git clone
options for gh repo clone
by pressing tab
twice after the --
flag.The completion script automatically populates suggestions, enabling faster interaction and execution with the GitHub CLI.
# Clone to a custom directory
+gh repo clone username/repo
+
+# Clone with a specific branch
+gh repo clone username/repo -- --branch feature-branch
+
+# Clone with depth limit
+gh repo clone username/repo -- --depth 1
+
Install the completion script:
curl -o ~/.gh-repo-clone-completion.bash https://gist.github.com/chriskyfung/50039cb2a9b586047adc2726085c6280/raw/.bash_profile
+
You can view the source code on GitHub Gist.
Add to your shell:
echo 'source ~/.gh-repo-clone-completion.bash' >> ~/.bashrc # for bash
+# OR
+echo 'source ~/.gh-repo-clone-completion.bash' >> ~/.zshrc # for zsh
+
Verify the Setup:
Type gh repo clone <tab>
in your terminal. If set up correctly, you should see repository suggestions as you type.
Type gh repo clone -- <tab>
in your terminal. You should see additional git clone
flags by listing them after --
.
Adding this custom completion function can really level up your GitHub CLI game, making it smoother and more user-friendly without the little frustrations. Give it a try and see how much faster your GitHub workflow becomes.
Got questions or suggestions?
+Feel free to contribute to the script on GitHub!
+Happy coding! 🚀
Learn how to supercharge your GitHub CLI experience with custom bash completion for the 'gh repo clone' command. Includes step-by-step setup and practical examples.
Learn how to supercharge your GitHub CLI experience with custom bash completion for the 'gh repo clone' command. Includes step-by-step setup and practical examples.
The changelog, the feature highlights, and the screenshots of the previous versions of the "Qwiklabs Lab Completion Tracker".
Label the completed labs and quests with a green check-circle () at the end of their titles.
The version 0.4.5 start covering the “Completed Courses” and “Completed Labs” pages under the My Learning section. Since the quests mix with speedrun games in the list of completed courses, each row of the game records highlights in purple color for distinguishing them.
The version 0.4.5 start covering the “Completed Courses” and “Completed Labs” pages under the My Learning section. Since the quests mix with speedrun games in the list of completed courses, each row of the game records highlights in purple color for distinguishing them.
Learn how to supercharge your GitHub CLI experience with custom bash completion for the 'gh repo clone' command. Includes step-by-step setup and practical examples.
Learn how to supercharge your GitHub CLI experience with custom bash completion for the 'gh repo clone' command. Includes step-by-step setup and practical examples.
This website use cookies to help you have a superior and more relevant browsing experience on the website. Read more...
Ever found yourself typing gh repo clone
and struggling to remember repository names? I’ve been there. As a developer who works with dozens of repositories daily, I needed a better solution. That’s why I created a custom completion script that makes the GitHub CLI’s clone command more powerful and user-friendly.
While the standard gh repo clone
is incredibly useful, it lacks intelligent autocompletion. Here’s what you’re missing:
$ gh repo clone my<tab>
-my-awesome-project my-docker-images my-python-scripts
-
I struggled to recall exact repository names, some of which are a mouthful. Then there were the flags that I could never remember. These tiny hurdles added up, hindering productivity, especially for those who constantly work with multiple repositories.
Driven by the desire for seamless interaction, I embarked on a quest to enhance my command-line experience. Instead of wrestling with repository names and flags, I decided to create a custom completion script for the gh repo clone
command. The script enables:
git clone
options for gh repo clone
by pressing tab
twice after the --
flag.The completion script automatically populates suggestions, enabling faster interaction and execution with the GitHub CLI.
# Clone to a custom directory
-gh repo clone username/repo
-
-# Clone with a specific branch
-gh repo clone username/repo -- --branch feature-branch
-
-# Clone with depth limit
-gh repo clone username/repo -- --depth 1
-
Install the completion script:
curl -o ~/.gh-repo-clone-completion.bash https://gist.github.com/chriskyfung/50039cb2a9b586047adc2726085c6280/raw/.bash_profile
-
You can view the source code and contribute on GitHub Gist.
Add to your shell:
echo 'source ~/.gh-repo-clone-completion.bash' >> ~/.bashrc # for bash
-# OR
-echo 'source ~/.gh-repo-clone-completion.bash' >> ~/.zshrc # for zsh
-
Verify the Setup:
Type gh repo clone <tab>
in your terminal. If set up correctly, you should see repository suggestions as you type.
Type gh repo clone -- <tab>
in your terminal. You should see additional git clone
flags by listing them after --
.
Implementing this custom completion function can transform your GitHub CLI experience by making it more efficient and user-friendly. My coding sessions are now more about creativity and less about the little frustrations.
Try it yourself and see how much faster your GitHub workflow becomes. Questions or suggestions? Feel free to contribute to the script on my GitHub!
Happy coding! 🚀