start work on more mr config, add readme

This commit is contained in:
2023-03-08 17:21:02 -08:00
parent 144d4f6b87
commit 7455da4355
2 changed files with 13 additions and 7 deletions

View File

@@ -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.

View File

@@ -10,13 +10,13 @@ import (
) )
type MRConfig struct { type MRConfig struct {
Unregister string Repos []Repo
GC string Aliases map[string]string
Repos []Repo
} }
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)
} }