gpl

package module
v0.0.0-...-4ab8bee Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2016 License: MIT Imports: 12 Imported by: 0

README

gpl - Update multiple local repositories with parallel

Build Status Go Report Card MIT License

Description

gpl will update your selected multiple local repositories with parallel. Support git, git-svn, svn, mercurial, darcs.
It was developed on the assumption that mainly to rely on other commands. Got the idea from things that I wanted to update with parallel when I used ghq(1) every time. But ghq(1) is great tool. So I'm expected that ghq(1) would support repository update with parallel in the future.

Usage

gpl -h # help
gpl -v # version
gpl /user/local/project/repo1 /user/local/project/repo2 ...

If you have created such as this file

cat list.txt
/user/local/project/repo1
/user/local/project/repo2

You can do this

cat list.txt | gpl -s

The most recommended is this combination with ghq and peco

ghq list -p | peco | gpl -s

Installation

go get -u github.com/Code-Hex/gpl/cmd/gpl

Binary

You can download binaries from here

Author

codehex

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DoUpdate = map[string]func(Gpl, string) error{
	".git": func(gpl Gpl, path string) error {
		return gpl.do(path, "git", "pull", "--ff-only")
	},
	".svn": func(gpl Gpl, path string) error {
		return gpl.do(path, "svn", "update")
	},
	".git/svn": func(gpl Gpl, path string) error {
		return gpl.do(path, "git", "svn", "rebase")
	},
	".hg": func(gpl Gpl, path string) error {
		return gpl.do(path, "hg", "pull", "--update")
	},
	"_darcs": func(gpl Gpl, path string) error {
		return gpl.do(path, "darcs", "pull")
	},
}

DoUpdate for will update each repositories

Functions

This section is empty.

Types

type Gpl

type Gpl struct {
	Trace       bool
	CPU         int
	TargetPaths []string
	Args        []string
	Stdin       io.Reader
	Stdout      io.Writer
	Stderr      io.Writer
	Exec        func(string, string, ...string) (string, error)
}

Gpl struct

func New

func New() *Gpl

New will return Gpl struct

func (Gpl) DetectRepository

func (gpl Gpl) DetectRepository() map[string]string

DetectRepository for detecting the kind of repositories from filepath

func (*Gpl) Parse

func (gpl *Gpl) Parse() error

Parse method will parsing for gpl command line arguments.

func (*Gpl) Run

func (gpl *Gpl) Run() int

Run is executed gpl command This is main method

func (*Gpl) Update

func (gpl *Gpl) Update() error

Update will be run gpl command. At first, parse command line arguments. Next, will detecting kind of repositories to update local repositories. Finally, update local repositories using parallel.

func (Gpl) UpdateRepository

func (gpl Gpl) UpdateRepository(dict map[string]string) error

UpdateRepository for update repositories

type Options

type Options struct {
	Help    bool `short:"h" long:"help"`
	Version bool `short:"v" long:"version"`
	Stdin   bool `short:"s" long:"stdin"`
	Trace   bool `long:"trace"`
}

Options struct for parse command line arguments

Directories

Path Synopsis
cmd
gpl

Jump to

Keyboard shortcuts

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