mirror of
https://github.com/taigrr/mg.git
synced 2026-04-02 03:28:42 -07:00
start work on more mr config, add readme
This commit is contained in:
@@ -11,6 +11,7 @@ This app will support the following subcommands:
|
|||||||
- mg pull
|
- mg pull
|
||||||
- mg fetch
|
- mg fetch
|
||||||
- mg register
|
- mg register
|
||||||
|
- mg unregister
|
||||||
|
|
||||||
Passing the `-jX` argument will spin up X jobs simultaneously
|
Passing the `-jX` argument will spin up X jobs simultaneously
|
||||||
|
|
||||||
@@ -18,12 +19,14 @@ mg supports loading an existing ~/.mrconfig and migrating it to ~/.config/mg.con
|
|||||||
|
|
||||||
|
|
||||||
## Improvements over mr:
|
## Improvements over mr:
|
||||||
1. No external dependencies (except for git)
|
1. No external dependencies (even git!*)
|
||||||
1. More output options (summary of failures)
|
1. More output options (summary of failures)
|
||||||
1. More deterministic behavior (global vs local run)
|
1. More deterministic behavior (global vs local run)
|
||||||
1. Exports public functions and can be embedded into other Go programs idiomatically
|
1. Exports public functions and can be embedded into other Go programs idiomatically
|
||||||
|
|
||||||
|
|
||||||
## Why to stick with mr:
|
## Why to stick with mr:
|
||||||
1. If you need support for non-git repos
|
1. If you need support for non-git VCS tooling
|
||||||
1. If you want to use the [mr plugin ecosystem](https://myrepos.branchable.com/#:~:text=repos%20to%20myrepos-,related%20software,-garden%3A%20manage%20git)
|
1. If you want to use the [mr plugin ecosystem](https://myrepos.branchable.com/#:~:text=repos%20to%20myrepos-,related%20software,-garden%3A%20manage%20git)
|
||||||
|
|
||||||
|
*: custom-registered commands may rely on external applications.
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type MRConfig struct {
|
type MRConfig struct {
|
||||||
Unregister string
|
|
||||||
GC string
|
|
||||||
Repos []Repo
|
Repos []Repo
|
||||||
|
Aliases map[string]string
|
||||||
}
|
}
|
||||||
type Repo struct {
|
type Repo struct {
|
||||||
Path string
|
Path string
|
||||||
Checkout string
|
Checkout string
|
||||||
|
Aliases map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m MRConfig) GetRepoPaths() []string {
|
func (m MRConfig) GetRepoPaths() []string {
|
||||||
@@ -82,12 +82,15 @@ func LoadMRConfig() (MRConfig, error) {
|
|||||||
return MRConfig{}, fmt.Errorf("unexpected argument on line %d: %s", n, line)
|
return MRConfig{}, fmt.Errorf("unexpected argument on line %d: %s", n, line)
|
||||||
}
|
}
|
||||||
config.Repos[length].Checkout = split[1]
|
config.Repos[length].Checkout = split[1]
|
||||||
|
|
||||||
case "default":
|
case "default":
|
||||||
|
|
||||||
|
// TODO load text into Aliases map instead of hardcoded Unregister prop
|
||||||
switch split[0] {
|
switch split[0] {
|
||||||
case "unregister":
|
case "unregister":
|
||||||
config.Unregister = split[1]
|
config.Aliases["unregister"] = split[1]
|
||||||
case "git_gc":
|
case "git_gc":
|
||||||
config.GC = split[1]
|
config.Aliases["gc"] = split[1]
|
||||||
default:
|
default:
|
||||||
return MRConfig{}, fmt.Errorf("unexpected argument on line %d: %s", n, line)
|
return MRConfig{}, fmt.Errorf("unexpected argument on line %d: %s", n, line)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user