kcg

command module
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

README

kcg

license Go Report Card build Go version release Coverage Status GitHub all releases

日本語ドキュメント (Japanese Documents Available)

Table of Contents

Overview

If you use multiple repositories in your application development, you may have found it tedious to git switch main and git pull for each one. kcg is a tool that reduces this hassle a little.

Features
  • Easily manage multiple repositories
  • Narrow down the target with filter or group option.

Install

homebrew
brew tap kumak1/homebrew-ktools 
brew install kcg
go
go get github.com/kumak1/kcg@latest

Getting Started

default configuration file place is ~/.kcg .

command description
kcg configure init Generate configuration file (if not file exists)
kcg configure import --ghq Add setting managed by ghq
kcg configure import --path="path/to/config" Import settings from specified file into configure file ( ~/.kcg )
kcg configure import --url="url/to/config" Import settings from specified url file into configure file ( ~/.kcg )
kcg configure set <name> --repo="git@host:org/repo.git" Set repository setting (required)
kcg configure set <name> --path="path/to/repo" Set repository save path setting(required. ghq user is not required)
kcg configure set <name> --group="group_a" Set group setting
kcg configure add <name> --group="group_a" Add group setting
kcg configure set <name> --branch-alias="main:master" Set branch alias setting.
example: main to master
kcg configure add <name> --branch-alias="main:master" Add branch alias setting.
example: main to master
kcg configure delete <name> Delete repository setting
Quick Start Example
kcg configure init
kcg configure set kumak1/kcg \
  --repo="[email protected]:kumak1/kcg.git" \
  --path="~/src/github.com/kumak1/kcg/"

if you using ghq

kcg configure import --ghq
Share config file Example
sender
kcg configure export --filter="kcg" | gh gist create --public
receiver
kcg configure import --url="gist_raw_file_url"

Usage

command description
kcg ls Show repository data in configuration file.
kcg cleanup Delete merged branch on each repository in configuration file.
kcg clone Run git clone on each repository in configure file.
kcg pull Run git pull on each repository in configure file.
kcg switch <branch_name> Run git switch on each repository in configure file.

Can use narrow down repository option. --filter="needle" --group="group_name"

Execute Specify Commands

command description
kcg exec list Show registered exec commands.
kcg exec set <name> -n "command_name" -c "command" Register exec commands.
kcg exec <command_name> Execute registered commands.

Can use narrow down repository option. --filter="needle" --group="group_name"

Set and Execute Example
% kcg exec set kumak1/kcg --name="test" --command="go test -race -covermode atomic --coverprofile=coverage.out ./..."

% kcg exec list
test:
  kumak1/kcg

% kcg exec test
✔ kumak1/kcg
run go test -race -covermode atomic --coverprofile=coverage.out ./...
?   	github.com/kumak1/kcg	[no test files]
?   	github.com/kumak1/kcg/cmd	[no test files]
ok  	github.com/kumak1/kcg/exec	1.410s	coverage: 100.0% of statements
ok  	github.com/kumak1/kcg/exec/ghq	0.961s	coverage: 100.0% of statements
ok  	github.com/kumak1/kcg/exec/git	0.573s	coverage: 100.0% of statements
ok  	github.com/kumak1/kcg/kcg	1.081s	coverage: 100.0% of statements
Command Details
% kcg -h
This is git command wrapper CLI.

Usage:
  kcg [command]

Available Commands:
  cleanup     delete merged branch on each repository dir
  clone       run `git clone` each repository
  completion  Generate the autocompletion script for the specified shell
  configure   Operate config file
  exec        Run commands on each repository
  help        Help about any command
  ls          Show repository list.
  pull        run `git pull` on each repository dir
  switch      run `git switch` on each repository dir

Flags:
      --config string   config file (default is $HOME/.kcg)
  -h, --help            help for kcg
  -v, --version         version for kcg

Use "kcg [command] --help" for more information about a command.

Documentation

Overview

Copyright © 2022 kumak1

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis
ghq
git

Jump to

Keyboard shortcuts

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