gogh

module
v4.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2025 License: MIT

README

Gogh

Gogh is a tool to manage GitHub repositories efficiently, inspired by ghq.

PkgGoDev Go Report Card Coverage Status GitHub release

Description

gogh is forked from ghq.

$ gogh list
github.com/kyoh86/git-branches
github.com/kyoh86/gogh
github.com/kyoh86/vim-wipeout
github.com/kyoh86-tryouts/bare
github.com/nvim-telescope/telescope.nvim
...

gogh provides a way to organize remote repository clones, like go clone does. When you clone a remote repository by gogh clone, gogh makes a directory under a specific root directory (by default ~/go/src) using the remote repository URL's host and path. And creating new one by gogh create, gogh make both of a local repositories and a remote repository.

$ gogh clone https://github.com/kyoh86/gogh
# Runs `git clone https://github.com/kyoh86/gogh ~/go/src/github.com/kyoh86/gogh`

You can also do:

  • List repositories (local repositories) (gogh list).
  • Create a new repository (gogh create).
  • Fork a repository (gogh fork).
  • Clone a repository (gogh clone).
  • Delete a repository (gogh delete).
  • List remote repositories (gogh repos).

See #Available commands for more information.

Install

For Golang developers

Ensure you have Go installed before running the following commands.

$ go install github.com/kyoh86/gogh/v4/cmd/gogh

If you want zsh-completions, you can create completions file like this:

$ echo "autoload -Uz compinit && compinit" >> ~/.zshrc
$ gogh completion zsh > $fpath[1]/_gogh
Homebrew/Linuxbrew
$ brew tap kyoh86/tap
$ brew update
$ brew install kyoh86/tap/gogh

Setup

gogh manages repositories in multiple servers that is pairs of an owner and a host name. To login in new server or logout, you should use auth login.

Available commands

See doc/usage/gogh.md for detailed command usage.

Show repositories
Command Description
cwd Print the local repository which the current working directory belongs to
list List local repositories
repos List remote repositories
Manipulate repositories
Command Description
clone Clone remote repositories to local
create Create a new local and remote repository
delete Delete local and remote repository
fork Fork a repository
Configurations
Command Description
auth Manage tokens
config Show / Change configurations
migrate Migrate configurations
roots Manage roots
Others
Command Description
bundle Manage bundle
completion Generate the autocompletion script for the specified shell
help Help about any command

Use gogh [command] --help for more information about a command. Or see the manual in doc/usage/gogh.md.

Environment variables

  • GOGH_CONFIG_PATH
    • (DEPRECATED) The path to the configuration file.
    • Default: ${XDG_CONFIG_HOME}/gogh/config.yaml.
  • GOGH_DEBUG
    • Enable debug mode.
    • Default: ``.
    • Set to 1 to enable debug mode.
  • GOGH_DEFAULT_NAMES_PATH
    • The path for the default names.
    • Default: ${XDG_CONFIG_HOME}/gogh/default_names.v4.toml
  • GOGH_FLAG_PATH
    • The path for values for each gogh flags.
    • Default: ${XDG_CONFIG_HOME}/gogh/flags.v4.toml
  • GOGH_TOKENS_PATH
    • The path for the tokens.
    • Default: ${XDG_CACHE_HOME}/gogh/tokens.v4.toml
  • GOGH_WORKSPACE_PATH
    • The path for the workspaces.
    • Default: ${XDG_CONFIG_HOME}/gogh/workspace.v4.toml

Configurations

Roots

gogh manages repositories under the roots directories.

See also: Directory structures

You can change the roots with roots add <path> or roots remove <path> and see all of them by roots list. gogh uses the primary one to create, fork or clone to put a local repository under it. If you want to change the primary, use roots set-primary <path>.

Default: ${HOME}/Projects.

Default Host and Owner

When you specify a repository with ambiguous user or host, it will be interpolated with a default value. You may set them with config set-default-host <host> and config set-default-owner <host> <owner>.

If you set them like below:

key value
host example.com
owner kyoh86

ambiguous repository names will be interpolated:

Ambiguous name Interpolated name
gogh example.com/kyoh86/gogh
foobar/gogh example.com/foobar/gogh

NOTE: default host will be "github.com" if you don't set it.

Flags

You can set flags for each command in the configuration file. The flags are used to set the default values for each command. You can set the flags in the configuration file like this:

[repos]
    limit = 7
    archive = "not-archived"
[bundle-restore]
    request-timeout = 5

Directory structures

Local repositories are placed under gogh.roots with named `host/user/repo.

~/Projects             -- primary root
    +-- github.com/
        |-- google/
        |   +-- go-github/
        |-- kyoh86/
        |   +-- gogh/
        +-- alecthomas/
            +-- kingpin/
/path/to/another/root  -- another root
    +-- github.com/
        |-- kyoh86/
        |   +-- gogh/
        |   +-- git-branches/
        |   +-- vim-wipeout/
        |   +-- bare/
        |   +-- tryouts/
        |-- anybody/
            +-- yyy/
/...

LICENSE

MIT License

This software is released under the MIT License, see LICENSE. And this software is based on ghq.

Directories

Path Synopsis
app
cwd
repository_print/repotab
Package repotab provides a formatter which show repositories as a table in CLI
Package repotab provides a formatter which show repositories as a table in CLI
cmd
gogh command
core
git
git
github
Package github provides GitHub API v3 adaptor
Package github provides GitHub API v3 adaptor
github_mock
Package github_mock is a generated GoMock package.
Package github_mock is a generated GoMock package.
githubv4
Package githubv4 provides GitHub API v4 adaptor
Package githubv4 provides GitHub API v4 adaptor
ui
cli

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL