rhq 0.2.3

manages Git repositories
Documentation

rhq - Manages your local repositories

License: MIT Build Status Build status

rhq is a command-line repository management tool, written in Rust.

Overview

rhq provides a way to organize local repositories cloned by Git and other VCSs. You can use the command rhq clone as alternative of git clone, to clone remote repositories under a specific root directory with intuitive directory structure.

$ rhq clone ubnt-intrepid/rhq
# Equivalent to `git clone https://github.com/ubnt-intrepid/rhq.git ~/.rhq/github.com/ubnt-intrepid/rhq`
~/.rhq/
  |- github.com/
  |  |- ubnt-intrepid/
  |  |  `- rhq/         <- clones with intuitive directory structure
  |  `- user2/
  |     `- repo3/
  `- gitlab.com/
     `- user3/
        `- repo4/

rhq also provides a way to list the location of managed local repositories.

$ rhq list
/home/username/.rhq/github.com/ubnt-intrepid/rhq
/home/username/.zplug/repos/zsh-users/zsh-autosuggestions
...

Installation

You can download precompiled artifacts from GitHub releases page.

If you have already installed Rust toolchain, builing manually is available with following command:

$ cargo install rhq  # from crates.io
$ cargo install --git https://github.com/ubnt-intrepid/rhq.git  # development version

Commands

rhq clone [<query>]

Clone remote reposities into the local directory.

Arguments

  • <query> - A string to determine the URL of remote repository.
    Available formats are:

    • URL: (http|https|ssh|git)://github.com[:port]/username/repository.git
    • SCP-like pattern: git@github.com:username/repository.git
    • relative path: username/repository

    When <query> is omitted, rhq try to get the list of queries from standard input.

Options

  • --arg=<arg> - Supplemental arguments to pass git command
  • -n | --dry-run - Show message string, instead of actually performing Git command
  • --root=<root> - Target root directory of cloned repository.

rhq new <query>

Create a new Git repository with intuitive directory structure.

Arguments

See rhq clone (but <query> is required)

Options

See rhq clone

rhq scan

Scan directories to create cache of repositories list.

Arguments

None

Options

  • -v, --verbose - Use verbose output

rhq list

List local repositories managed by rhq.

Arguments

None

Options

None

rhq foreach <command> [<args>...]

Execute commands into each local repositories.

Arguments

  • <command> - Command name
  • <args>... - Supplemental arguments of command

Options

  • -n | --dry-run - Show message string, instead of actually performing Git command.

rhq completion <shell> [<out-file>]

Generate completion script for your shell. If out-file is omitted, dump scirpt to standard output.

Arguments

  • <shell> - Target shell name (value: bash, zsh, fish or powershell)
  • <out-file> - Path to write completion script

Configuration

The behaviour of rhq can change by using configuration files. The location of configuration file is ~/.rhqconfig or ~/.config/rhq/config.

  • root - string
    The path of root directory to put in local repositories. The default value is ~/.rhq.

  • supplements - array of strings
    Supplemental directories for lookup local repositories.

See .rhqconfig for details.

Plugins

Vim

mattn/ctrlp-ghq is available. If you are vim-plug user, try as follows:

Plug 'mattn/ctrlp-ghq'

let g:ctrlp_ghq_command = 'rhq'
let g:ctrlp_ghq_actions = [ { "label": "Open", "action": "Explore", "path": 0 } ]

noremap <Leader>g :<C-u>CtrlPGhq<CR>

Visual Studio Code

Extensions for Visual Studio Code is available. See here for details.

Similar projects