🚀 Yet another repository management with auto-attaching profiles.

Overview

🚀 ghr

crates.io Rust

Yet another repository management with auto-attaching profiles.

🔥 Motivation

ghq is the most famous solution to resolve stress of our repository management currently. However, I wanted to customise the git configuration by some rules, such as using my company email in their repositories.

To achieve that, ghq was not enough for me. So I have rewritten them as simple, in Rust, the robust and modern language today.

📦 Installation

cargo install ghr

💚 Usages

Usage: ghr <COMMAND>

Commands:
  clone    Clones a Git repository to local
  delete   Deletes a repository from local
  init     Initialises a Git repository in local
  path     Prints the path to root, owner, or a repository
  profile  Manages profiles to use in repositories
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help information

Cloning a repository

ghr supports many patterns or URLs of the repository to clone:

ghr clone <owner>/<repo>
ghr clone github.com:<owner>/<repo>
ghr clone https://github.com/<owner>/<repo>.git
ghr clone ssh://[email protected]/<owner>/<repo>.git
ghr clone [email protected]:<owner>/<repo>.git

Easy!

Attaching profiles

Create ~/.ghr/config.toml and edit as you like:

[profiles.default]
user.name = "Your Name"
user.email = "[email protected]"

[profiles.company]
user.name = "Your Name (ACME Inc.)"
user.email = "[email protected]"

[[rules]]
profile.name = "company"
owner = "acme" # Applies company profiles to all repositories in `acme` org

[[rules]]
profile.name = "default"

Finding path of the repository

ghr path # Root directory
ghr path <owner> # Owner root
ghr path <owner> <repo> # Repository directory
ghr path --host=github.com # Host root
ghr path --host=github.com <owner> # Owner root of the specified host
ghr path --host=github.com <owner> <repo> # Repository directory of the specified host

🛠 Customising

You can change the root of repositories managed by ghr by setting environment variable GHR_ROOT in your shell profile.

ghr path # ~/.ghr
GHR_ROOT=/path/to/root ghr path # /path/to/root
Comments
  • Bug report: list command does not work

    Bug report: list command does not work

    Thanks for a nice tool!

    I have a trouble that ghr list command does not work. I'd love to know if you have any solution.

    ❯ ghr list
    error: The subcommand 'list' wasn't recognized
    
    Usage: ghr <COMMAND>
    
    For more information try '--help'
    

    Other commands, such as ghr cd, ghr clone or ghr delete is working as expected.

    My environment

    OS: macOS Monterey shell: fish version:

    ❯ ghr version
    ghr v0.2.2 built with rustc 1.65.0 (897e37553 2022-11-02) at 2022-11-29 03:20:54Z
    
    opened by hajimism 2
  • fix: Resolve bash extension causes shell to exit

    fix: Resolve bash extension causes shell to exit

    Hi, @siketyan. I have been using your ghr. Source code management has become very comfortable. Thank you very much!!!

    This PR fixes a small bug that caused the interactive shell to exit when executing commands that fail after installing the bash extension.

    $ echo 'eval "$(ghr shell bash)"' >> .bashrc # or other shell config file
    
    $ exec $SHELL -l
    
    $ false # interactive shell exit here
    

    This problem was caused by set -e in resources/shell/ghr.bash, so this line has been removed. Similarly, set -u has been removed because it may cause problems for some users (as it did for me).

    Thank you!

    opened by ryuma017 2
  • build(deps): bump tokio from 1.21.2 to 1.23.1

    build(deps): bump tokio from 1.21.2 to 1.23.1

    Bumps tokio from 1.21.2 to 1.23.1.

    Release notes

    Sourced from tokio's releases.

    Tokio v1.23.1

    This release forward ports changes from 1.18.4.

    Fixed

    • net: fix Windows named pipe server builder to maintain option when toggling pipe mode (#5336).

    #5336: tokio-rs/tokio#5336

    Tokio v1.23.0

    Fixed

    • net: fix Windows named pipe connect (#5208)
    • io: support vectored writes for ChildStdin (#5216)
    • io: fix async fn ready() false positive for OS-specific events (#5231)

    Changed

    • runtime: yield_now defers task until after driver poll (#5223)
    • runtime: reduce amount of codegen needed per spawned task (#5213)
    • windows: replace winapi dependency with windows-sys (#5204)

    #5208: tokio-rs/tokio#5208 #5216: tokio-rs/tokio#5216 #5213: tokio-rs/tokio#5213 #5204: tokio-rs/tokio#5204 #5223: tokio-rs/tokio#5223 #5231: tokio-rs/tokio#5231

    Tokio v1.22.0

    Added

    • runtime: add Handle::runtime_flavor (#5138)
    • sync: add Mutex::blocking_lock_owned (#5130)
    • sync: add Semaphore::MAX_PERMITS (#5144)
    • sync: add merge() to semaphore permits (#4948)
    • sync: add mpsc::WeakUnboundedSender (#5189)

    Added (unstable)

    • process: add Command::process_group (#5114)
    • runtime: export metrics about the blocking thread pool (#5161)
    • task: add task::id() and task::try_id() (#5171)

    Fixed

    • macros: don't take ownership of futures in macros (#5087)
    • runtime: fix Stacked Borrows violation in LocalOwnedTasks (#5099)
    • runtime: mitigate ABA with 32-bit queue indices when possible (#5042)
    • task: wake local tasks to the local queue when woken by the same thread (#5095)
    • time: panic in release mode when mark_pending called illegally (#5093)
    • runtime: fix typo in expect message (#5169)

    ... (truncated)

    Commits
    • 1a997ff chore: prepare Tokio v1.23.1 release
    • a8fe333 Merge branch 'tokio-1.20.x' into tokio-1.23.x
    • ba81945 chore: prepare Tokio 1.20.3 release
    • 763bdc9 ci: run WASI tasks using latest Rust
    • 9f98535 Merge remote-tracking branch 'origin/tokio-1.18.x' into fix-named-pipes-1.20
    • 9241c3e chore: prepare Tokio v1.18.4 release
    • 699573d net: fix named pipes server configuration builder
    • 3ce5a26 chore: prepare Tokio v1.23 release (#5270)
    • 644cb82 rt: fix *_closed false positives (#5231)
    • a1316cd io: impl std::io::BufRead on SyncIoBridge\<T> (#5265)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • feat: Resolve <repo> pattern using default owner

    feat: Resolve pattern using default owner

    ghr now supports resolving only pattern if you have setup the default owner. Setting the default is so easy:

    [defaults]
    owner = "siketyan"
    

    Add this to your ghr.toml and done!

    Now you can init/clone/open/delete repos without specifying the owner.

    ghr clone <repo>
    
    opened by siketyan 0
  • Listing all managed repositories

    Listing all managed repositories

    Before implementing #7, we need to know what repositories are managed under the ghr root. We need to walk directories in the root and find all directories matching <host>/<owner>/<repo>.

    opened by siketyan 0
  • feat: Open in intermediate application

    feat: Open in intermediate application

    Closes #14

    Now you can open in some of application such as code, phpstorm, clion and more without any configuration, if the app supports opening by invoking in [cmd] [path] format.

    opened by siketyan 0
  • feat: Open application in a repository

    feat: Open application in a repository

    Closes #2

    After cloned a repository, we often want to open some application such as IDE or editor in the cloned repository directory. We utilised that in a simple way.

    To use this feature, you need to configure applications you want to open first. The following example shows an application entry opening Visual Studio Code.

    [applications.vscode]
    cmd = "code"
    args = ["%p"]
    

    Note that an argument %p is replaced by the actual repository path.

    Now you can use ghr clone --open or ghr open:

    ghr clone siketyan/ghr --open vscode
    ghr open siketyan/ghr vscode
    
    opened by siketyan 0
  • feat: Use Git CLI for cloning repositories by default

    feat: Use Git CLI for cloning repositories by default

    The Git backend ghr uses was libgit2 in v0.1 releases. However, in this strategy, we could not clone repository in an authenticated context (e.g. cloning your private repo, or your organisation's repo).

    Now ghr uses Git CLI (git command simply) by default. You can also change this behaviour by modifying config.toml file as follows:

    [git]
    stategy.clone = "git2"  # `cli` or `git2`
    

    Have fun!

    opened by siketyan 0
  • Open repository in the associated application by default

    Open repository in the associated application by default

    ghr open, ghr init --open, and ghr clone --open requires specifying what application to open currently. When opening the repo in the associated application (i.e. Finder on macOS), we need to specify them as ghr open <repo> open or ghr clone <repo> --open open. It's a little complicated and not easy to understand.

    So we need to open repository in the associated app by default, without specifying what app to open. i.e. ghr open <repo> opens the repo in the app.

    opened by siketyan 0
  • Execute a command to initialise some stuff

    Execute a command to initialise some stuff

    ghr clone siketyan/test --init npm
    

    will run npm i in the repository directory after cloning. It requires configuration before using the feature.

    [initializers.npm]
    cd = { cmd = "npm", args = ["i"] }
    default = { cmd = "npm", args = ["ci"] }
    

    With the configuration above, ghr will execute npm i after ghr cd, otherwise npm ci.

    opened by siketyan 0
Releases(v0.2.3)
Owner
Naoki Ikeguchi
A Rust lover, Minarai of CTO, Chiikawa Evangelist. they/them
Naoki Ikeguchi
Attempt to make a git profile switcher to switch profiles.

Git Profile Switcher █▀▀ █ ▀█▀   █▀ █░█░█ █ ▀█▀ █▀▀ █░█ █▀▀ █▀█ █▄█ █ ░█░   ▄█ ▀▄▀▄▀ █ ░█░ █▄▄ █▀█

Srikanth K 2 Sep 23, 2022
Yay - Yet another Yogurt - An AUR Helper written in Go

Yay Yet Another Yogurt - An AUR Helper Written in Go Help translate yay: Transifex Features Advanced dependency solving PKGBUILD downloading from ABS

J Guerreiro 8.6k Jan 1, 2023
yet another typing test, but crab flavoured

toipe A trusty terminal typing tester for the tux. Usage Install cargo install toipe Run typing test toipe looks best on a nice terminal (such as Ala

Samyak Sarnayak 431 Dec 20, 2022
Yet another fractal generator (based on glium)

Juliabrot Yet another fractal generator. Juliabrot is a Rust application using the OpenGL Framework to render in realtime. Install Rust To download Ru

Max 2 Feb 27, 2022
Yet another package manager for Rust.

Rpip Installing. Make sure you have just (packages) installed! Once you have just installed move into the root directory (where this file is) and run

null 2 Apr 27, 2022
Yet another Codeforces cli

cf-tool-rs A Rust implement for https://github.com/xalanq/cf-tool WIP. Pull Requests / Contributions are welcomed! How to Configure? Configure File sh

Woshiluo Luo 2 May 8, 2022
Yet Another Kalman Filter Implementation. As well as Lie Theory (Lie group and algebra) on SE(3). [no_std] is supported by default.

yakf - Yet Another Kalman Filter Yet Another Kalman Filter Implementation, as well as, Lie Theory (Lie group, algebra, vector) on SO(3), SE(3), SO(2),

null 7 Dec 1, 2022
Yet another lightweight and easy to use HTTP(S) server

Raptor Web server Raptor is a HTTP server written in Rust with aims to use as little memory as possible and an easy configuration. It is built on top

Volham 5 Oct 15, 2022
Yet Another Texture Packer - a small and simple CLI application to pack multiple textures/sprites into a texture atlas/sprite sheet

YATP (Yet Another Texture Packer) A small and simple CLI application to pack multiple textures/sprites into a texture atlas/sprite sheet. Installation

Petar Petrov 2 Sep 11, 2022
Yet another sort crate, porting Golang sort package to Rust.

IndexSort IndexSort Yet another sort crate (in place), porting Golang's standard sort package to Rust. Installation [dependencies] indexsort = "0.1.0"

Al Liu 4 Sep 28, 2022
Yet another phigros chart player.

prpr - P hig R os P layer, written in R ust Usage To begin with, clone the repo: git clone https://github.com/Mivik/prpr.git && cd prpr For compactnes

Mivik 6 Jan 1, 2023
⚡🦀 Yet another rust system info fetcher.

Yarsi: Yet another rust sys info fetcher ✨ Showcase requirements ?? cargo ?? install with $ curl https://sh.rustup.rs -sSf | sh installation ❤️‍?? Ya

BinaryBrainiacs 8 Jan 26, 2023
YAL is Yet Another scripting Language(but worse)

YAL - Yet Another Language YAL is yet another scripting language(but worse). Syntax Basic syntax fun main() { print("Hello, World!"); } Fibonacci

MD Gaziur Rahman Noor 16 Nov 14, 2022
Yet another command-line chat GPT frontend written in Rust.

gpterm Yet another command-line chat GPT frontend written in Rust. Features Stream output with typing effect Store chat messages/history Context aware

Makis Christou 22 May 4, 2023
Yet another code execution engine written in Rust.

exec Yet another blazingly fast code execution engine written in Rust. Paths GET /api/v1/status GET /api/v1/runtimes POST /api/v1/execute POST /api/v1

Stefan Asandei 2 Jul 11, 2023
Nerf is (yet another) rust GUI lib

NERF Nerf is (yet another) rust GUI lib. It is heavily inspired by Flutter, and is designed to build apps that could run on any plateforms, such as wi

Eclipse 14 Jul 27, 2023
Yet another Python environment manager.

yen The easiest Python environment manager. Create virtual environments for any Python version, without needing Python pre-installed. Installation Get

Tushar Sadhwani 19 Oct 7, 2023
This is a `Rust` based package to help with the management of complex medicine (pill) management cycles.

reepicheep This is a Rust based package to help with the management of complex medicine (pill) management cycles. reepicheep notifies a person(s) via

Daniel B 24 Dec 13, 2023
Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're working with files or directories, this tool simplifies common file operations with ease.

Rust FileOps Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're w

Harikesh Ranjan Sinha 5 May 2, 2024