Code Monkey home page Code Monkey logo

gogh's Introduction

Gogh

GO GitHub project manager

PkgGoDev Go Report Card Coverage Status 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 get does. When you clone a remote repository by gogh get, 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 new, gogh make both of a local project and a remote repository.

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

You can also list projects (local repositories) (gogh list).

Install

For Golang developers

$ go install github.com/kyoh86/gogh/cmd/gogh@latest

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

Makepkg

$ mkdir -p gogh_build && \
  cd gogh_build && \
  curl -L --silent https://github.com/kyoh86/gogh/releases/latest/download/gogh_PKGBUILD.tar.gz | tar -xvz
$ makepkg -i

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 with personal access tokens.

You should generate personal access tokens with repository permissions:

  • ✔️ Read access to code and metadata
  • ✔️ Read and Write access to administration

Available commands

See manual for detail: usage/gogh.md.

Show projects

Command Description
gogh list List local projects
gogh repos List remote repositories

Manipulate projects

Command Description
gogh create Create a new project with a remote repository
gogh delete Delete a repository with a remote repository
gogh fork Fork a repository
gogh clone Clone a repository to local

Others

Command Description
gogh roots Manage roots
gogh auth Manage Authentications
gogh bundle Manage bundle
gogh help Help about any command

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

Configurations

Roots

gogh manages projects 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 first one as the default one, create, fork or clone will put a local project under it. If you want to change the default, use roots set-default <path>.

Default: ~/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 set-default.

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.

Directory structures

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

~/Projects
+-- github.com/
|-- google/
|   +-- go-github/
|-- kyoh86/
|   +-- gogh/
+-- alecthomas/
  +-- kingpin/

LICENSE

MIT License

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

gogh's People

Contributors

dependabot[bot] avatar kyoh86 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gogh's Issues

make gogogh command

gogogh : change working directory to path to the project;

Make it by shell-script because subprocesses cannot change working directory.

support custom format in the list

to support kyoh86/vim-gogh#1 ,
gogh list should be able to list name & fullpath in parallel

like

gogh<SEP>/home/kyoh86/Projects/github.com/kyohiy/gogh
vim-gogh<SEP>/home/kyoh86/Projects/github.com/kyohiy/gogh
gogh<SEP>/home/kyoh86/Projects/github.com/kyohiy/gogh

getするとwarnが出る

$ gogh get kyoh86/gogh
Cloning into '/Users/kyoh86/Projects/github.com/kyoh86/gogh'...
remote: Enumerating objects: 46, done.
remote: Counting objects: 100% (46/46), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 1823 (delta 12), reused 39 (delta 12), pack-reused 1777
Receiving objects: 100% (1823/1823), 2.67 MiB | 2.64 MiB/s, done.
Resolving deltas: 100% (886/886), done.
/Users/kyoh86/Projects/github.com/kyoh86/gogh
[  warn ] 14:01:15 Exists /Users/kyoh86/Projects/github.com/kyoh86/gogh
$ 

unravel gogh.Context

It's not "Context"ual object.
Global Function (like config.UserName())

attention:

  • to keep testable
  • to cacheable (about high cost property)

Initial, cannot set config with `config put`

$ mv ~/.config/gogh/config.yaml ~/.config/gogh/config.yaml.old
$ gogh config put github.user kyoh86
2020/01/05 19:52:08 error: invalid GitHub user in the context; set a valid name by 'gogh config put github
.user <GitHub user name>': owner name may only contain alphanumeric characters or single hyphens, and cann
ot begin or end with a hyphen
[1]

Update README.md

  • where and repo isn't in SYNOPSIS and COMMANDS
  • gogh.github.user isn't in CONFIG

List item duplicated

If the git configuration gogh.root have duplicated paths, gogh shows one path twice.

$ git config --global gogh.root ${HOME}  # GLOBAL
$ git config gogh.root ${HOME}           # LOCAL

$ mkdir -p $HOME/github.com/kyoh86/dummy
$ git -C $HOME/github.com/kyoh86/dummy init

$ gogh list --format full
/Users/kyoh86/github.com/kyoh86/dummy
/Users/kyoh86/github.com/kyoh86/dummy

in offline, idempotent "gogh new"

$ gogh new gordon
Initialized empty Git repository in /home/kyoh86/Projects/github.com/kyoh86/gordon/.git/
Error creating repository: Post https://api.github.com/user/repos: dial tcp: lookup api.github.com: Tempor
ary failure in name resolution
[1]

$ gogh new gordon
[ error ] 15:08:52 project already exists                  
[1]

Use GitHub Actions

  • yo go-project --projectName ${PWD##*/} --author ${${PWD%/*}##*/} --license MIT --dir ${PWD}
  • git rm -rf .circleci
  • sudo rm -rf "$(go env GOPATH)/pkg" && go get -v -d -t ./... && go mod tidy
  • git add -p and git commit -m "Replace Circle-CI with GitHub Actions"
  • Set CODECOV_TOKEN and GORELEASER_GITHUB_TOKEN on repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.