mirror of
https://github.com/taigrr/mg.git
synced 2026-04-02 03:28:42 -07:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 50f5bc897d | |||
| 0f925f852e | |||
| cacdbf673f | |||
|
|
991985ab4e | ||
| 417cf943fa | |||
| 1030a8f3a9 | |||
| f0c6f3906a | |||
| 01c736b54e | |||
| e93a0489d3 | |||
| 567ab899e0 | |||
| a889092b0d | |||
|
1a593ad588
|
|||
|
c5310d13b0
|
|||
|
256e82cca2
|
|||
|
b99b1eabec
|
|||
|
f503d4b0eb
|
|||
|
f368381458
|
|||
|
a5817c554b
|
|||
|
15122346d1
|
|||
|
c2d67df8f0
|
|||
|
84d7a73202
|
|||
|
662d80fbf5
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
cmd/mg/mg
|
||||||
|
.crush
|
||||||
234
AGENTS.md
Normal file
234
AGENTS.md
Normal file
@@ -0,0 +1,234 @@
|
|||||||
|
# AGENTS.md
|
||||||
|
|
||||||
|
Agent guide for the `mg` codebase - a Go replacement for [myrepos](https://myrepos.branchable.com/) that only supports git repos.
|
||||||
|
|
||||||
|
## Project Overview
|
||||||
|
|
||||||
|
`mg` is a CLI tool for managing multiple git repositories simultaneously. It uses `go-git/go-git` for pure Go git operations (no external git dependency required) and `spf13/cobra` for CLI structure.
|
||||||
|
|
||||||
|
### Key Features
|
||||||
|
|
||||||
|
- Parallel operations via `-j` flag
|
||||||
|
- Compatible with existing `~/.mrconfig` files (auto-migrates to `mgconfig`)
|
||||||
|
- Pure Go implementation - no external git binary needed
|
||||||
|
- Embeddable as a library
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build
|
||||||
|
go build ./...
|
||||||
|
|
||||||
|
# Run tests
|
||||||
|
go test ./...
|
||||||
|
|
||||||
|
# Install the binary
|
||||||
|
go install ./cmd/mg
|
||||||
|
|
||||||
|
# Run directly
|
||||||
|
go run ./cmd/mg <command>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
mg/
|
||||||
|
├── cmd/
|
||||||
|
│ ├── mg/
|
||||||
|
│ │ ├── main.go # Entry point
|
||||||
|
│ │ └── cmd/ # Cobra commands
|
||||||
|
│ │ ├── root.go # Root command setup
|
||||||
|
│ │ ├── common.go # Shared utilities (GetConfig)
|
||||||
|
│ │ ├── clone.go # Clone all repos (implemented)
|
||||||
|
│ │ ├── pull.go # Pull all repos (implemented)
|
||||||
|
│ │ ├── register.go # Register repo (implemented)
|
||||||
|
│ │ ├── unregister.go# Unregister repo (implemented)
|
||||||
|
│ │ ├── import.go # Merge configs (implemented)
|
||||||
|
│ │ ├── push.go # Stub
|
||||||
|
│ │ ├── fetch.go # Stub
|
||||||
|
│ │ ├── status.go # Stub
|
||||||
|
│ │ ├── diff.go # Stub
|
||||||
|
│ │ ├── commit.go # Stub
|
||||||
|
│ │ └── config.go # Stub
|
||||||
|
│ └── paths/
|
||||||
|
│ └── mrpaths.go # Utility to list repo paths from mrconfig
|
||||||
|
└── parse/
|
||||||
|
├── mgconf.go # MGConfig: JSON-based config format
|
||||||
|
├── myrepos.go # MRConfig: Parse ~/.mrconfig (INI-style)
|
||||||
|
└── myrepos_test.go # Tests (skeleton)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Implementation Status
|
||||||
|
|
||||||
|
| Command | Status | Notes |
|
||||||
|
|--------------|-------------|------------------------------------|
|
||||||
|
| `clone` | Implemented | Parallel via `-j`, creates dirs |
|
||||||
|
| `pull` | Implemented | Parallel via `-j` |
|
||||||
|
| `register` | Implemented | Detects git root, stores `$HOME` |
|
||||||
|
| `unregister` | Implemented | By path or current dir |
|
||||||
|
| `import` | Implemented | Merge configs, supports stdin `-` |
|
||||||
|
| `push` | Stub | Prints "push called" |
|
||||||
|
| `fetch` | Stub | Prints "fetch called" |
|
||||||
|
| `status` | Stub | Prints "status called" |
|
||||||
|
| `diff` | Stub | Prints "diff called" |
|
||||||
|
| `commit` | Stub | Prints "commit called" |
|
||||||
|
| `config` | Stub | Prints "config called" |
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
### Config File Location
|
||||||
|
|
||||||
|
1. `$MGCONFIG` environment variable (if set)
|
||||||
|
2. `$XDG_CONFIG_HOME/mgconfig`
|
||||||
|
3. `~/.config/mgconfig`
|
||||||
|
|
||||||
|
### Config Format (JSON)
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"Repos": [
|
||||||
|
{
|
||||||
|
"Path": "$HOME/code/project",
|
||||||
|
"Remote": "git@github.com:user/project.git"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Aliases": {}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Migration from myrepos
|
||||||
|
|
||||||
|
If no `mgconfig` exists but `~/.mrconfig` does, `mg` auto-migrates on first run. The `MRConfig.ToMGConfig()` method handles conversion.
|
||||||
|
|
||||||
|
## Code Patterns
|
||||||
|
|
||||||
|
### Adding a New Command
|
||||||
|
|
||||||
|
1. Create `cmd/mg/cmd/<name>.go`
|
||||||
|
2. Define a `cobra.Command` variable
|
||||||
|
3. Register in `init()` via `rootCmd.AddCommand()`
|
||||||
|
4. For parallel operations, follow the pattern in `clone.go` or `pull.go`:
|
||||||
|
|
||||||
|
```go
|
||||||
|
var myCmd = &cobra.Command{
|
||||||
|
Use: "mycommand",
|
||||||
|
Short: "description",
|
||||||
|
Run: func(_ *cobra.Command, args []string) {
|
||||||
|
conf := GetConfig() // Load config with fallback to mrconfig
|
||||||
|
// Implementation...
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rootCmd.AddCommand(myCmd)
|
||||||
|
myCmd.Flags().IntVarP(&jobs, "jobs", "j", 1, "number of parallel jobs")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parallel Execution Pattern
|
||||||
|
|
||||||
|
Used in `clone.go` and `pull.go`:
|
||||||
|
|
||||||
|
```go
|
||||||
|
repoChan := make(chan RepoType, len(repos))
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
mutex := sync.Mutex{}
|
||||||
|
errs := []Error{}
|
||||||
|
|
||||||
|
wg.Add(len(repos))
|
||||||
|
for i := 0; i < jobs; i++ {
|
||||||
|
go func() {
|
||||||
|
for repo := range repoChan {
|
||||||
|
// Do work
|
||||||
|
// Use mutex for shared state (errs, counters)
|
||||||
|
wg.Done()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, repo := range repos {
|
||||||
|
repoChan <- repo
|
||||||
|
}
|
||||||
|
close(repoChan)
|
||||||
|
wg.Wait()
|
||||||
|
```
|
||||||
|
|
||||||
|
### Git Operations
|
||||||
|
|
||||||
|
Use `go-git/go-git/v5`:
|
||||||
|
|
||||||
|
```go
|
||||||
|
import git "github.com/go-git/go-git/v5"
|
||||||
|
|
||||||
|
// Open repo (detects .git in parent dirs)
|
||||||
|
r, err := git.PlainOpenWithOptions(path, &git.PlainOpenOptions{DetectDotGit: true})
|
||||||
|
|
||||||
|
// Clone
|
||||||
|
_, err = git.PlainClone(path, false, &git.CloneOptions{URL: remote})
|
||||||
|
|
||||||
|
// Pull
|
||||||
|
w, _ := r.Worktree()
|
||||||
|
err = w.Pull(&git.PullOptions{})
|
||||||
|
// Check: err == git.NoErrAlreadyUpToDate
|
||||||
|
```
|
||||||
|
|
||||||
|
### Path Handling
|
||||||
|
|
||||||
|
- Paths in config use `$HOME` prefix for portability
|
||||||
|
- `GetConfig()` in `common.go` expands `$HOME` to actual home directory at runtime
|
||||||
|
- `register` command stores paths with `$HOME` prefix
|
||||||
|
|
||||||
|
## Key Types
|
||||||
|
|
||||||
|
### `parse.MGConfig`
|
||||||
|
|
||||||
|
```go
|
||||||
|
type MGConfig struct {
|
||||||
|
Repos []Repo
|
||||||
|
Aliases map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Methods
|
||||||
|
func LoadMGConfig() (MGConfig, error)
|
||||||
|
func (m *MGConfig) AddRepo(path, remote string) error
|
||||||
|
func (m *MGConfig) DelRepo(path string) error
|
||||||
|
func (m *MGConfig) Merge(m2 MGConfig) (Stats, error)
|
||||||
|
func (m MGConfig) Save() error
|
||||||
|
```
|
||||||
|
|
||||||
|
### `parse.Repo`
|
||||||
|
|
||||||
|
```go
|
||||||
|
type Repo struct {
|
||||||
|
Path string
|
||||||
|
Remote string
|
||||||
|
Aliases map[string]string `json:"aliases,omitempty"`
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- `github.com/go-git/go-git/v5` - Pure Go git implementation
|
||||||
|
- `github.com/spf13/cobra` - CLI framework
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
Tests are minimal. Only `parse/myrepos_test.go` exists with a skeleton structure:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go test ./...
|
||||||
|
```
|
||||||
|
|
||||||
|
## Known Issues / TODOs
|
||||||
|
|
||||||
|
1. Several commands are stubs (push, fetch, status, diff, commit, config)
|
||||||
|
2. `parse/mgconf.go:61` has a hint about inefficient string concatenation in a loop
|
||||||
|
3. Test coverage is minimal
|
||||||
|
4. `unregister` command short description incorrectly says "add current path" (copy-paste error)
|
||||||
|
|
||||||
|
## Error Handling Pattern
|
||||||
|
|
||||||
|
Commands typically:
|
||||||
|
1. Log errors via `log.Println(err)`
|
||||||
|
2. Exit with `os.Exit(1)` on fatal errors
|
||||||
|
3. Collect errors during parallel operations and report summary at end
|
||||||
1
cmd/mg/.gitignore
vendored
Normal file
1
cmd/mg/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
main
|
||||||
106
cmd/mg/cmd/clone.go
Normal file
106
cmd/mg/cmd/clone.go
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
git "github.com/go-git/go-git/v5"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/taigrr/mg/parse"
|
||||||
|
)
|
||||||
|
|
||||||
|
// cloneCmd represents the clone command
|
||||||
|
var (
|
||||||
|
cloneCmd = &cobra.Command{
|
||||||
|
Use: "clone",
|
||||||
|
Short: "ensure all repos defined in the config are cloned",
|
||||||
|
Run: func(_ *cobra.Command, args []string) {
|
||||||
|
type RepoError struct {
|
||||||
|
Error error
|
||||||
|
Repo string
|
||||||
|
}
|
||||||
|
if jobs < 1 {
|
||||||
|
log.Println("jobs must be greater than 0")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
conf := GetConfig()
|
||||||
|
if len(args) > 0 {
|
||||||
|
log.Println("too many arguments")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
repoChan := make(chan parse.Repo, len(conf.Repos))
|
||||||
|
errs := []RepoError{}
|
||||||
|
alreadyCloned := 0
|
||||||
|
mutex := sync.Mutex{}
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
wg.Add(len(conf.Repos))
|
||||||
|
cloneFunc := func() {
|
||||||
|
for repo := range repoChan {
|
||||||
|
_, err := git.PlainOpenWithOptions(repo.Path, &(git.PlainOpenOptions{DetectDotGit: true}))
|
||||||
|
if err == nil {
|
||||||
|
log.Printf("already cloned: %s\n", repo.Path)
|
||||||
|
mutex.Lock()
|
||||||
|
alreadyCloned++
|
||||||
|
mutex.Unlock()
|
||||||
|
wg.Done()
|
||||||
|
continue
|
||||||
|
} else if err == git.ErrRepositoryNotExists {
|
||||||
|
log.Printf("attempting clone: %s\n", repo.Path)
|
||||||
|
parentPath := filepath.Dir(repo.Path)
|
||||||
|
if _, err := os.Stat(parentPath); err != nil {
|
||||||
|
os.MkdirAll(parentPath, os.ModeDir|os.ModePerm)
|
||||||
|
}
|
||||||
|
_, err = git.PlainClone(repo.Path, false, &git.CloneOptions{
|
||||||
|
URL: repo.Remote,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
mutex.Lock()
|
||||||
|
errs = append(errs, RepoError{Error: err, Repo: repo.Path})
|
||||||
|
mutex.Unlock()
|
||||||
|
log.Printf("clone failed for %s: %v\n", repo.Path, err)
|
||||||
|
wg.Done()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
fmt.Printf("successfully cloned %s\n", repo.Path)
|
||||||
|
wg.Done()
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
mutex.Lock()
|
||||||
|
errs = append(errs, RepoError{Error: err, Repo: repo.Path})
|
||||||
|
mutex.Unlock()
|
||||||
|
log.Printf("clone failed for %s: %v\n", repo.Path, err)
|
||||||
|
wg.Done()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for i := 0; i < jobs; i++ {
|
||||||
|
go cloneFunc()
|
||||||
|
}
|
||||||
|
fmt.Println(len(conf.Repos))
|
||||||
|
for _, repo := range conf.Repos {
|
||||||
|
repoChan <- repo
|
||||||
|
}
|
||||||
|
close(repoChan)
|
||||||
|
fmt.Println("waiting...")
|
||||||
|
wg.Wait()
|
||||||
|
for _, err := range errs {
|
||||||
|
log.Printf("error pulling %s: %s\n", err.Repo, err.Error)
|
||||||
|
}
|
||||||
|
lenErrs := len(errs)
|
||||||
|
fmt.Println()
|
||||||
|
fmt.Printf("successfully cloned %d/%d repos\n", len(conf.Repos)-lenErrs, len(conf.Repos))
|
||||||
|
fmt.Printf("%d repos already cloned\n", alreadyCloned)
|
||||||
|
fmt.Printf("failed to clone %d/%d repos\n", lenErrs, len(conf.Repos))
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rootCmd.AddCommand(cloneCmd)
|
||||||
|
cloneCmd.Flags().IntVarP(&jobs, "jobs", "j", 1, "number of jobs to run in parallel")
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
var commitCmd = &cobra.Command{
|
var commitCmd = &cobra.Command{
|
||||||
Use: "commit",
|
Use: "commit",
|
||||||
Short: "commit all current repos with the same message",
|
Short: "commit all current repos with the same message",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, args []string) {
|
||||||
fmt.Println("commit called")
|
fmt.Println("commit called")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,5 +27,6 @@ func GetConfig() parse.MGConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
conf.ExpandPaths()
|
||||||
return conf
|
return conf
|
||||||
}
|
}
|
||||||
|
|||||||
64
cmd/mg/cmd/import.go
Normal file
64
cmd/mg/cmd/import.go
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/taigrr/mg/parse"
|
||||||
|
)
|
||||||
|
|
||||||
|
var importCmd = &cobra.Command{
|
||||||
|
Use: "import <file>",
|
||||||
|
Short: "merge a new mgconfig into the current one",
|
||||||
|
Args: cobra.ExactArgs(1),
|
||||||
|
Run: func(_ *cobra.Command, args []string) {
|
||||||
|
conf := GetConfig()
|
||||||
|
if args[0] == "-" {
|
||||||
|
f, err := io.ReadAll(os.Stdin)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
parsed, err := parse.ParseMGConfig(f)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
stats, err := conf.Merge(parsed)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
fmt.Println(stats)
|
||||||
|
} else {
|
||||||
|
f, err := os.ReadFile(args[0])
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
parsed, err := parse.ParseMGConfig(f)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
stats, err := conf.Merge(parsed)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
fmt.Println(stats)
|
||||||
|
}
|
||||||
|
err := conf.Save()
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rootCmd.AddCommand(importCmd)
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ var (
|
|||||||
jobs int
|
jobs int
|
||||||
pullCmd = &cobra.Command{
|
pullCmd = &cobra.Command{
|
||||||
Use: "pull",
|
Use: "pull",
|
||||||
Short: "add current path to list of repos",
|
Short: "update all git repos specified in config",
|
||||||
Run: func(_ *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, args []string) {
|
||||||
type RepoError struct {
|
type RepoError struct {
|
||||||
Error error
|
Error error
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ var registerCmd = &cobra.Command{
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
path = newPath.Filesystem.Root()
|
path = newPath.Filesystem.Root()
|
||||||
|
|
||||||
for _, v := range conf.Repos {
|
for _, v := range conf.Repos {
|
||||||
if v.Path == path {
|
if v.Path == path {
|
||||||
fmt.Printf("repo %s already registered\n", path)
|
fmt.Printf("repo %s already registered\n", path)
|
||||||
|
|||||||
@@ -2,14 +2,44 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"runtime/debug"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func getVersion() string {
|
||||||
|
info, ok := debug.ReadBuildInfo()
|
||||||
|
if !ok {
|
||||||
|
return "dev"
|
||||||
|
}
|
||||||
|
if info.Main.Version != "" && info.Main.Version != "(devel)" {
|
||||||
|
return info.Main.Version
|
||||||
|
}
|
||||||
|
var revision, dirty string
|
||||||
|
for _, s := range info.Settings {
|
||||||
|
switch s.Key {
|
||||||
|
case "vcs.revision":
|
||||||
|
revision = s.Value
|
||||||
|
case "vcs.modified":
|
||||||
|
if s.Value == "true" {
|
||||||
|
dirty = "-dirty"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if revision != "" {
|
||||||
|
if len(revision) > 7 {
|
||||||
|
revision = revision[:7]
|
||||||
|
}
|
||||||
|
return revision + dirty
|
||||||
|
}
|
||||||
|
return "dev"
|
||||||
|
}
|
||||||
|
|
||||||
// rootCmd represents the base command when called without any subcommands
|
// rootCmd represents the base command when called without any subcommands
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "mg",
|
Use: "mg",
|
||||||
Short: "go replacement for myrepos which only supports git repos",
|
Short: "go replacement for myrepos which only supports git repos",
|
||||||
|
Version: getVersion(),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute adds all child commands to the root command and sets flags appropriately.
|
// Execute adds all child commands to the root command and sets flags appropriately.
|
||||||
|
|||||||
34
go.mod
34
go.mod
@@ -1,27 +1,35 @@
|
|||||||
module github.com/taigrr/mg
|
module github.com/taigrr/mg
|
||||||
|
|
||||||
go 1.20
|
go 1.25.5
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/go-git/go-git/v5 v5.3.0
|
github.com/go-git/go-git/v5 v5.16.4
|
||||||
github.com/spf13/cobra v1.7.0
|
github.com/spf13/cobra v1.10.2
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Microsoft/go-winio v0.5.2 // indirect
|
dario.cat/mergo v1.0.2 // indirect
|
||||||
|
github.com/Microsoft/go-winio v0.6.2 // indirect
|
||||||
|
github.com/ProtonMail/go-crypto v1.3.0 // indirect
|
||||||
|
github.com/cloudflare/circl v1.6.2 // indirect
|
||||||
|
github.com/cyphar/filepath-securejoin v0.6.1 // indirect
|
||||||
github.com/emirpasic/gods v1.18.1 // indirect
|
github.com/emirpasic/gods v1.18.1 // indirect
|
||||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||||
github.com/go-git/go-billy/v5 v5.4.1 // indirect
|
github.com/go-git/go-billy/v5 v5.7.0 // indirect
|
||||||
github.com/imdario/mergo v0.3.15 // indirect
|
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
github.com/kevinburke/ssh_config v1.4.0 // indirect
|
||||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
||||||
github.com/sergi/go-diff v1.1.0 // indirect
|
github.com/pjbgf/sha1cd v0.5.0 // indirect
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
github.com/sergi/go-diff v1.4.0 // indirect
|
||||||
|
github.com/skeema/knownhosts v1.3.2 // indirect
|
||||||
|
github.com/spf13/pflag v1.0.10 // indirect
|
||||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||||
golang.org/x/crypto v0.9.0 // indirect
|
golang.org/x/crypto v0.47.0 // indirect
|
||||||
golang.org/x/net v0.10.0 // indirect
|
golang.org/x/mod v0.32.0 // indirect
|
||||||
golang.org/x/sys v0.8.0 // indirect
|
golang.org/x/net v0.49.0 // indirect
|
||||||
|
golang.org/x/sys v0.40.0 // indirect
|
||||||
|
golang.org/x/tools v0.41.0 // indirect
|
||||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
205
go.sum
205
go.sum
@@ -1,122 +1,197 @@
|
|||||||
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
|
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
|
||||||
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
|
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
|
||||||
github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA=
|
dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8=
|
||||||
|
dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA=
|
||||||
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
|
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
|
||||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs=
|
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
|
||||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
|
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
|
||||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
|
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
|
||||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
|
||||||
|
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c h1:kMFnB0vCcX7IL/m9Y5LO+KQYv+t1CQOiFe6+SV2J7bE=
|
||||||
|
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
|
||||||
|
github.com/ProtonMail/go-crypto v1.3.0 h1:ILq8+Sf5If5DCpHQp4PbZdS1J7HDFRXz/+xKBiRGFrw=
|
||||||
|
github.com/ProtonMail/go-crypto v1.3.0/go.mod h1:9whxjD8Rbs29b4XWbB8irEcE8KHMqaR2e7GWU1R+/PE=
|
||||||
|
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
|
||||||
|
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
|
||||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
|
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
|
||||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
|
||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
|
||||||
|
github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
|
||||||
|
github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA=
|
||||||
|
github.com/cloudflare/circl v1.6.2 h1:hL7VBpHHKzrV5WTfHCaBsgx/HGbBYlgrwvNXEVDYYsQ=
|
||||||
|
github.com/cloudflare/circl v1.6.2/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
||||||
|
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
|
||||||
|
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
|
||||||
|
github.com/cyphar/filepath-securejoin v0.6.1 h1:5CeZ1jPXEiYt3+Z6zqprSAgSWiggmpVyciv8syjIpVE=
|
||||||
|
github.com/cyphar/filepath-securejoin v0.6.1/go.mod h1:A8hd4EnAeyujCJRrICiOWqjS1AX0a9kM5XL+NwKoYSc=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
|
github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU=
|
||||||
|
github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM=
|
||||||
|
github.com/elazarl/goproxy v1.7.2 h1:Y2o6urb7Eule09PjlhQRGNsqRfPmYI3KKQLFpCAV3+o=
|
||||||
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
|
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
|
||||||
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
|
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
|
||||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY=
|
||||||
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
|
github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4=
|
||||||
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
|
||||||
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
|
|
||||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
|
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
|
||||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
|
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
|
||||||
github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU=
|
||||||
github.com/go-git/go-billy/v5 v5.1.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow=
|
||||||
github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4=
|
github.com/go-git/go-billy/v5 v5.7.0 h1:83lBUJhGWhYp0ngzCMSgllhUSuoHP1iEWYjsPl9nwqM=
|
||||||
github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg=
|
github.com/go-git/go-billy/v5 v5.7.0/go.mod h1:/1IUejTKH8xipsAcdfcSAlUlo2J7lkYV8GTKxAT/L3E=
|
||||||
github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12 h1:PbKy9zOy4aAKrJ5pibIRpVO2BXnK1Tlcg+caKI7Ox5M=
|
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4=
|
||||||
github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw=
|
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
|
||||||
github.com/go-git/go-git/v5 v5.3.0 h1:8WKMtJR2j8RntEXR/uvTKagfEt4GYlwQ7mntE4+0GWc=
|
github.com/go-git/go-git/v5 v5.11.0 h1:XIZc1p+8YzypNr34itUfSvYJcv+eYdTnTvOZ2vD3cA4=
|
||||||
github.com/go-git/go-git/v5 v5.3.0/go.mod h1:xdX4bWJ48aOrdhnl2XqHYstHbbp6+LFS4r4X+lNVprw=
|
github.com/go-git/go-git/v5 v5.11.0/go.mod h1:6GFcX2P3NM7FPBfpePbpLd21XxsgdAt+lKqXmCUiUCY=
|
||||||
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
|
github.com/go-git/go-git/v5 v5.16.4 h1:7ajIEZHZJULcyJebDLo99bGgS0jRrOxzZG4uCk2Yb2Y=
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/go-git/go-git/v5 v5.16.4/go.mod h1:4Ge4alE/5gPs30F2H1esi2gPd69R0C39lolkucHBOp8=
|
||||||
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
|
||||||
github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||||
github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
|
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ=
|
||||||
|
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw=
|
||||||
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
|
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
|
||||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
|
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
|
||||||
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
|
|
||||||
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
|
||||||
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
|
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
|
||||||
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
github.com/kevinburke/ssh_config v1.4.0 h1:6xxtP5bZ2E4NF5tuQulISpTO2z8XbtH8cg1PWkxoFkQ=
|
||||||
|
github.com/kevinburke/ssh_config v1.4.0/go.mod h1:q2RIzfka+BXARoNexmF9gkxEX7DmvbW9P4hIVx2Kg4M=
|
||||||
|
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
|
||||||
|
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
|
||||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI=
|
||||||
|
github.com/pjbgf/sha1cd v0.5.0 h1:a+UkboSi1znleCDUNT3M5YxjOnN1fz2FhN48FlwCxs0=
|
||||||
|
github.com/pjbgf/sha1cd v0.5.0/go.mod h1:lhpGlyHLpQZoxMv8HcgXvZEhcGs0PG/vsZnEJ7H0iCM=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||||
|
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
|
||||||
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
|
||||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw=
|
||||||
|
github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
|
||||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||||
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
|
github.com/skeema/knownhosts v1.2.1 h1:SHWdIUa82uGZz+F+47k8SY4QhhI291cXCpopT1lK2AQ=
|
||||||
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
|
github.com/skeema/knownhosts v1.2.1/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo=
|
||||||
|
github.com/skeema/knownhosts v1.3.2 h1:EDL9mgf4NzwMXCTfaxSD/o/a5fxDw/xL9nkU28JjdBg=
|
||||||
|
github.com/skeema/knownhosts v1.3.2/go.mod h1:bEg3iQAuw+jyiw+484wwFJoKSLwcfd7fqRy+N0QTiow=
|
||||||
|
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
|
||||||
|
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
|
||||||
|
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
|
||||||
|
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
|
||||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
|
||||||
|
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0=
|
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||||
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
|
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
|
||||||
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
|
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
|
||||||
golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
|
golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||||
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||||
|
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
|
||||||
|
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
|
||||||
|
golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8=
|
||||||
|
golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A=
|
||||||
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||||
|
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||||
|
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
|
||||||
|
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||||
|
golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c=
|
||||||
|
golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU=
|
||||||
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k=
|
|
||||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
|
||||||
|
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
|
||||||
|
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
|
||||||
|
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
|
||||||
|
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
|
||||||
|
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
|
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
|
||||||
|
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
|
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||||
|
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||||
|
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||||
|
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
|
||||||
|
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
|
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
|
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
|
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||||
|
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||||
|
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
|
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||||
|
golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA=
|
||||||
|
golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
|
||||||
|
golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc=
|
||||||
|
golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg=
|
||||||
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
|
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
|
||||||
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package parse
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var errAlreadyRegistered = os.ErrExist
|
var errAlreadyRegistered = os.ErrExist
|
||||||
@@ -50,11 +51,44 @@ func (m *MGConfig) AddRepo(path, remote string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Stats struct {
|
||||||
|
Duplicates int
|
||||||
|
NewPaths []string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s Stats) String() string {
|
||||||
|
str := ""
|
||||||
|
for _, v := range s.NewPaths {
|
||||||
|
str += "Added repo " + v + "\n"
|
||||||
|
}
|
||||||
|
str += "\nAdded " + fmt.Sprintf("%d", len(s.NewPaths)) + " new repos\n"
|
||||||
|
str += "Skipped " + fmt.Sprintf("%d", s.Duplicates) + " duplicate repos"
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MGConfig) Merge(m2 MGConfig) (Stats, error) {
|
||||||
|
stats := Stats{}
|
||||||
|
for _, v := range m2.Repos {
|
||||||
|
err := m.AddRepo(v.Path, v.Remote)
|
||||||
|
switch err {
|
||||||
|
case errAlreadyRegistered:
|
||||||
|
stats.Duplicates++
|
||||||
|
continue
|
||||||
|
case nil:
|
||||||
|
stats.NewPaths = append(stats.NewPaths, v.Path)
|
||||||
|
continue
|
||||||
|
default:
|
||||||
|
|
||||||
|
return stats, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stats, nil
|
||||||
|
}
|
||||||
|
|
||||||
// LoadMGConfig loads the mgconfig file from the XDG_CONFIG_HOME directory
|
// LoadMGConfig loads the mgconfig file from the XDG_CONFIG_HOME directory
|
||||||
// or from the default location of $HOME/.config/mgconfig
|
// or from the default location of $HOME/.config/mgconfig
|
||||||
// If the file is not found, an error is returned
|
// If the file is not found, an error is returned
|
||||||
func LoadMGConfig() (MGConfig, error) {
|
func LoadMGConfig() (MGConfig, error) {
|
||||||
var config MGConfig
|
|
||||||
mgConf := os.Getenv("MGCONFIG")
|
mgConf := os.Getenv("MGCONFIG")
|
||||||
if mgConf == "" {
|
if mgConf == "" {
|
||||||
confDir := os.Getenv("XDG_CONFIG_HOME")
|
confDir := os.Getenv("XDG_CONFIG_HOME")
|
||||||
@@ -74,11 +108,38 @@ func LoadMGConfig() (MGConfig, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return MGConfig{}, err
|
return MGConfig{}, err
|
||||||
}
|
}
|
||||||
err = json.Unmarshal(file, &config)
|
return ParseMGConfig(file)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ParseMGConfig parses the mgconfig file from a byte slice
|
||||||
|
func ParseMGConfig(b []byte) (MGConfig, error) {
|
||||||
|
var config MGConfig
|
||||||
|
err := json.Unmarshal(b, &config)
|
||||||
return config, err
|
return config, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ExpandPaths expands shell variables in all repo paths using os.ExpandEnv.
|
||||||
|
// This allows paths like $HOME/code or $GOPATH/src to work cross-platform.
|
||||||
|
func (m *MGConfig) ExpandPaths() {
|
||||||
|
for i := range m.Repos {
|
||||||
|
m.Repos[i].Path = os.ExpandEnv(m.Repos[i].Path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CollapsePaths replaces the user's home directory with $HOME in all repo paths.
|
||||||
|
// This allows config files to be shared across machines with different home paths.
|
||||||
|
func (m *MGConfig) CollapsePaths() {
|
||||||
|
home, err := os.UserHomeDir()
|
||||||
|
if err != nil || home == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for i := range m.Repos {
|
||||||
|
if strings.HasPrefix(m.Repos[i].Path, home) {
|
||||||
|
m.Repos[i].Path = "$HOME" + m.Repos[i].Path[len(home):]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (m MGConfig) Save() error {
|
func (m MGConfig) Save() error {
|
||||||
mgConf := os.Getenv("MGCONFIG")
|
mgConf := os.Getenv("MGCONFIG")
|
||||||
if mgConf == "" {
|
if mgConf == "" {
|
||||||
@@ -95,9 +156,17 @@ func (m MGConfig) Save() error {
|
|||||||
}
|
}
|
||||||
mgConf = filepath.Join(confDir, "mgconfig")
|
mgConf = filepath.Join(confDir, "mgconfig")
|
||||||
}
|
}
|
||||||
b, err := json.MarshalIndent(m, "", " ")
|
// Collapse paths before saving so config is portable
|
||||||
|
toSave := MGConfig{
|
||||||
|
Repos: make([]Repo, len(m.Repos)),
|
||||||
|
Aliases: m.Aliases,
|
||||||
|
}
|
||||||
|
copy(toSave.Repos, m.Repos)
|
||||||
|
toSave.CollapsePaths()
|
||||||
|
|
||||||
|
b, err := json.MarshalIndent(toSave, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return ioutil.WriteFile(mgConf, b, 0o644)
|
return os.WriteFile(mgConf, b, 0o644)
|
||||||
}
|
}
|
||||||
|
|||||||
530
parse/mgconf_test.go
Normal file
530
parse/mgconf_test.go
Normal file
@@ -0,0 +1,530 @@
|
|||||||
|
package parse
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestExpandPaths(t *testing.T) {
|
||||||
|
// Set up test environment variables
|
||||||
|
t.Setenv("HOME", "/home/testuser")
|
||||||
|
t.Setenv("GOPATH", "/home/testuser/go")
|
||||||
|
t.Setenv("CUSTOM_VAR", "/custom/path")
|
||||||
|
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
input []Repo
|
||||||
|
expected []string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "expand $HOME",
|
||||||
|
input: []Repo{
|
||||||
|
{Path: "$HOME/code/project", Remote: "git@github.com:user/project.git"},
|
||||||
|
},
|
||||||
|
expected: []string{"/home/testuser/code/project"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "expand multiple variables",
|
||||||
|
input: []Repo{
|
||||||
|
{Path: "$HOME/code/project", Remote: "git@github.com:user/project.git"},
|
||||||
|
{Path: "$GOPATH/src/github.com/user/repo", Remote: "git@github.com:user/repo.git"},
|
||||||
|
},
|
||||||
|
expected: []string{
|
||||||
|
"/home/testuser/code/project",
|
||||||
|
"/home/testuser/go/src/github.com/user/repo",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "expand custom variable",
|
||||||
|
input: []Repo{
|
||||||
|
{Path: "$CUSTOM_VAR/subdir", Remote: "git@github.com:user/project.git"},
|
||||||
|
},
|
||||||
|
expected: []string{"/custom/path/subdir"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "no expansion needed",
|
||||||
|
input: []Repo{
|
||||||
|
{Path: "/absolute/path/to/repo", Remote: "git@github.com:user/project.git"},
|
||||||
|
},
|
||||||
|
expected: []string{"/absolute/path/to/repo"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "empty repos",
|
||||||
|
input: []Repo{},
|
||||||
|
expected: []string{},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "undefined variable stays as-is",
|
||||||
|
input: []Repo{
|
||||||
|
{Path: "$UNDEFINED_VAR/code", Remote: "git@github.com:user/project.git"},
|
||||||
|
},
|
||||||
|
expected: []string{"/code"}, // undefined vars expand to empty string
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "braced variable syntax",
|
||||||
|
input: []Repo{
|
||||||
|
{Path: "${HOME}/code/project", Remote: "git@github.com:user/project.git"},
|
||||||
|
},
|
||||||
|
expected: []string{"/home/testuser/code/project"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
conf := MGConfig{Repos: tt.input}
|
||||||
|
conf.ExpandPaths()
|
||||||
|
|
||||||
|
if len(conf.Repos) != len(tt.expected) {
|
||||||
|
t.Fatalf("expected %d repos, got %d", len(tt.expected), len(conf.Repos))
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, repo := range conf.Repos {
|
||||||
|
if repo.Path != tt.expected[i] {
|
||||||
|
t.Errorf("repo %d: expected path %q, got %q", i, tt.expected[i], repo.Path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCollapsePaths(t *testing.T) {
|
||||||
|
// Get the actual home directory for this test
|
||||||
|
home, err := os.UserHomeDir()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("failed to get home directory: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
input []Repo
|
||||||
|
expected []string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "collapse home directory",
|
||||||
|
input: []Repo{
|
||||||
|
{Path: filepath.Join(home, "code/project"), Remote: "git@github.com:user/project.git"},
|
||||||
|
},
|
||||||
|
expected: []string{"$HOME/code/project"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "collapse multiple paths",
|
||||||
|
input: []Repo{
|
||||||
|
{Path: filepath.Join(home, "code/project1"), Remote: "git@github.com:user/project1.git"},
|
||||||
|
{Path: filepath.Join(home, "code/project2"), Remote: "git@github.com:user/project2.git"},
|
||||||
|
},
|
||||||
|
expected: []string{
|
||||||
|
"$HOME/code/project1",
|
||||||
|
"$HOME/code/project2",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "path not under home",
|
||||||
|
input: []Repo{
|
||||||
|
{Path: "/opt/repos/project", Remote: "git@github.com:user/project.git"},
|
||||||
|
},
|
||||||
|
expected: []string{"/opt/repos/project"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "mixed paths",
|
||||||
|
input: []Repo{
|
||||||
|
{Path: filepath.Join(home, "code/project"), Remote: "git@github.com:user/project.git"},
|
||||||
|
{Path: "/opt/repos/other", Remote: "git@github.com:user/other.git"},
|
||||||
|
},
|
||||||
|
expected: []string{
|
||||||
|
"$HOME/code/project",
|
||||||
|
"/opt/repos/other",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "empty repos",
|
||||||
|
input: []Repo{},
|
||||||
|
expected: []string{},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "home directory itself",
|
||||||
|
input: []Repo{
|
||||||
|
{Path: home, Remote: "git@github.com:user/home.git"},
|
||||||
|
},
|
||||||
|
expected: []string{"$HOME"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
conf := MGConfig{Repos: tt.input}
|
||||||
|
conf.CollapsePaths()
|
||||||
|
|
||||||
|
if len(conf.Repos) != len(tt.expected) {
|
||||||
|
t.Fatalf("expected %d repos, got %d", len(tt.expected), len(conf.Repos))
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, repo := range conf.Repos {
|
||||||
|
if repo.Path != tt.expected[i] {
|
||||||
|
t.Errorf("repo %d: expected path %q, got %q", i, tt.expected[i], repo.Path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestExpandAndCollapse_Roundtrip(t *testing.T) {
|
||||||
|
home, err := os.UserHomeDir()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("failed to get home directory: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start with $HOME-based paths (as stored in config)
|
||||||
|
original := MGConfig{
|
||||||
|
Repos: []Repo{
|
||||||
|
{Path: "$HOME/code/project1", Remote: "git@github.com:user/project1.git"},
|
||||||
|
{Path: "$HOME/go/src/github.com/user/repo", Remote: "git@github.com:user/repo.git"},
|
||||||
|
{Path: "/opt/external/repo", Remote: "git@github.com:user/external.git"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// Expand paths (as done when loading)
|
||||||
|
conf := MGConfig{
|
||||||
|
Repos: make([]Repo, len(original.Repos)),
|
||||||
|
}
|
||||||
|
copy(conf.Repos, original.Repos)
|
||||||
|
conf.ExpandPaths()
|
||||||
|
|
||||||
|
// Verify expansion worked
|
||||||
|
expectedExpanded := []string{
|
||||||
|
filepath.Join(home, "code/project1"),
|
||||||
|
filepath.Join(home, "go/src/github.com/user/repo"),
|
||||||
|
"/opt/external/repo",
|
||||||
|
}
|
||||||
|
for i, repo := range conf.Repos {
|
||||||
|
if repo.Path != expectedExpanded[i] {
|
||||||
|
t.Errorf("after expand, repo %d: expected %q, got %q", i, expectedExpanded[i], repo.Path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collapse paths (as done when saving)
|
||||||
|
conf.CollapsePaths()
|
||||||
|
|
||||||
|
// Verify we're back to the original
|
||||||
|
for i, repo := range conf.Repos {
|
||||||
|
if repo.Path != original.Repos[i].Path {
|
||||||
|
t.Errorf("after roundtrip, repo %d: expected %q, got %q", i, original.Repos[i].Path, repo.Path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSave_CollapsesPaths(t *testing.T) {
|
||||||
|
home, err := os.UserHomeDir()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("failed to get home directory: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a temp file for the config
|
||||||
|
tmpDir := t.TempDir()
|
||||||
|
configPath := filepath.Join(tmpDir, "mgconfig")
|
||||||
|
t.Setenv("MGCONFIG", configPath)
|
||||||
|
|
||||||
|
// Create config with expanded (absolute) paths
|
||||||
|
conf := MGConfig{
|
||||||
|
Repos: []Repo{
|
||||||
|
{Path: filepath.Join(home, "code/project"), Remote: "git@github.com:user/project.git"},
|
||||||
|
{Path: "/opt/external/repo", Remote: "git@github.com:user/external.git"},
|
||||||
|
},
|
||||||
|
Aliases: map[string]string{"test": "echo test"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save should collapse paths
|
||||||
|
err = conf.Save()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Save() failed: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read back and verify paths are collapsed
|
||||||
|
data, err := os.ReadFile(configPath)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("failed to read saved config: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var saved MGConfig
|
||||||
|
if err := json.Unmarshal(data, &saved); err != nil {
|
||||||
|
t.Fatalf("failed to parse saved config: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
expectedPaths := []string{
|
||||||
|
"$HOME/code/project",
|
||||||
|
"/opt/external/repo",
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, repo := range saved.Repos {
|
||||||
|
if repo.Path != expectedPaths[i] {
|
||||||
|
t.Errorf("saved repo %d: expected path %q, got %q", i, expectedPaths[i], repo.Path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify original config wasn't modified
|
||||||
|
if conf.Repos[0].Path != filepath.Join(home, "code/project") {
|
||||||
|
t.Errorf("original config was modified: expected %q, got %q",
|
||||||
|
filepath.Join(home, "code/project"), conf.Repos[0].Path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestParseMGConfig(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
input string
|
||||||
|
wantRepos int
|
||||||
|
wantErr bool
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "valid config",
|
||||||
|
input: `{
|
||||||
|
"Repos": [
|
||||||
|
{"Path": "$HOME/code/project", "Remote": "git@github.com:user/project.git"}
|
||||||
|
],
|
||||||
|
"Aliases": {"gc": "git gc"}
|
||||||
|
}`,
|
||||||
|
wantRepos: 1,
|
||||||
|
wantErr: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "empty config",
|
||||||
|
input: `{"Repos": [], "Aliases": {}}`,
|
||||||
|
wantRepos: 0,
|
||||||
|
wantErr: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "invalid json",
|
||||||
|
input: `{invalid}`,
|
||||||
|
wantRepos: 0,
|
||||||
|
wantErr: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "multiple repos",
|
||||||
|
input: `{
|
||||||
|
"Repos": [
|
||||||
|
{"Path": "$HOME/code/project1", "Remote": "git@github.com:user/project1.git"},
|
||||||
|
{"Path": "$HOME/code/project2", "Remote": "git@github.com:user/project2.git"}
|
||||||
|
]
|
||||||
|
}`,
|
||||||
|
wantRepos: 2,
|
||||||
|
wantErr: false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
conf, err := ParseMGConfig([]byte(tt.input))
|
||||||
|
if (err != nil) != tt.wantErr {
|
||||||
|
t.Errorf("ParseMGConfig() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !tt.wantErr && len(conf.Repos) != tt.wantRepos {
|
||||||
|
t.Errorf("ParseMGConfig() got %d repos, want %d", len(conf.Repos), tt.wantRepos)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestAddRepo(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
initial []Repo
|
||||||
|
addPath string
|
||||||
|
addRemote string
|
||||||
|
wantErr bool
|
||||||
|
wantCount int
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "add to empty",
|
||||||
|
initial: []Repo{},
|
||||||
|
addPath: "$HOME/code/new",
|
||||||
|
addRemote: "git@github.com:user/new.git",
|
||||||
|
wantErr: false,
|
||||||
|
wantCount: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "add to existing",
|
||||||
|
initial: []Repo{
|
||||||
|
{Path: "$HOME/code/existing", Remote: "git@github.com:user/existing.git"},
|
||||||
|
},
|
||||||
|
addPath: "$HOME/code/new",
|
||||||
|
addRemote: "git@github.com:user/new.git",
|
||||||
|
wantErr: false,
|
||||||
|
wantCount: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "add duplicate",
|
||||||
|
initial: []Repo{
|
||||||
|
{Path: "$HOME/code/existing", Remote: "git@github.com:user/existing.git"},
|
||||||
|
},
|
||||||
|
addPath: "$HOME/code/existing",
|
||||||
|
addRemote: "git@github.com:user/existing.git",
|
||||||
|
wantErr: true,
|
||||||
|
wantCount: 1,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
conf := MGConfig{Repos: tt.initial}
|
||||||
|
err := conf.AddRepo(tt.addPath, tt.addRemote)
|
||||||
|
if (err != nil) != tt.wantErr {
|
||||||
|
t.Errorf("AddRepo() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
|
}
|
||||||
|
if len(conf.Repos) != tt.wantCount {
|
||||||
|
t.Errorf("AddRepo() repo count = %d, want %d", len(conf.Repos), tt.wantCount)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDelRepo(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
initial []Repo
|
||||||
|
delPath string
|
||||||
|
wantErr bool
|
||||||
|
wantCount int
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "delete existing",
|
||||||
|
initial: []Repo{
|
||||||
|
{Path: "$HOME/code/project", Remote: "git@github.com:user/project.git"},
|
||||||
|
},
|
||||||
|
delPath: "$HOME/code/project",
|
||||||
|
wantErr: false,
|
||||||
|
wantCount: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "delete from multiple",
|
||||||
|
initial: []Repo{
|
||||||
|
{Path: "$HOME/code/project1", Remote: "git@github.com:user/project1.git"},
|
||||||
|
{Path: "$HOME/code/project2", Remote: "git@github.com:user/project2.git"},
|
||||||
|
},
|
||||||
|
delPath: "$HOME/code/project1",
|
||||||
|
wantErr: false,
|
||||||
|
wantCount: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "delete non-existent",
|
||||||
|
initial: []Repo{
|
||||||
|
{Path: "$HOME/code/project", Remote: "git@github.com:user/project.git"},
|
||||||
|
},
|
||||||
|
delPath: "$HOME/code/other",
|
||||||
|
wantErr: true,
|
||||||
|
wantCount: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "delete from empty",
|
||||||
|
initial: []Repo{},
|
||||||
|
delPath: "$HOME/code/project",
|
||||||
|
wantErr: true,
|
||||||
|
wantCount: 0,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
conf := MGConfig{Repos: tt.initial}
|
||||||
|
err := conf.DelRepo(tt.delPath)
|
||||||
|
if (err != nil) != tt.wantErr {
|
||||||
|
t.Errorf("DelRepo() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
|
}
|
||||||
|
if len(conf.Repos) != tt.wantCount {
|
||||||
|
t.Errorf("DelRepo() repo count = %d, want %d", len(conf.Repos), tt.wantCount)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMerge(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
initial []Repo
|
||||||
|
merge []Repo
|
||||||
|
wantCount int
|
||||||
|
wantDuplicates int
|
||||||
|
wantNewPaths int
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "merge into empty",
|
||||||
|
initial: []Repo{},
|
||||||
|
merge: []Repo{
|
||||||
|
{Path: "$HOME/code/new", Remote: "git@github.com:user/new.git"},
|
||||||
|
},
|
||||||
|
wantCount: 1,
|
||||||
|
wantDuplicates: 0,
|
||||||
|
wantNewPaths: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "merge with duplicates",
|
||||||
|
initial: []Repo{
|
||||||
|
{Path: "$HOME/code/existing", Remote: "git@github.com:user/existing.git"},
|
||||||
|
},
|
||||||
|
merge: []Repo{
|
||||||
|
{Path: "$HOME/code/existing", Remote: "git@github.com:user/existing.git"},
|
||||||
|
{Path: "$HOME/code/new", Remote: "git@github.com:user/new.git"},
|
||||||
|
},
|
||||||
|
wantCount: 2,
|
||||||
|
wantDuplicates: 1,
|
||||||
|
wantNewPaths: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "merge all duplicates",
|
||||||
|
initial: []Repo{
|
||||||
|
{Path: "$HOME/code/project", Remote: "git@github.com:user/project.git"},
|
||||||
|
},
|
||||||
|
merge: []Repo{
|
||||||
|
{Path: "$HOME/code/project", Remote: "git@github.com:user/project.git"},
|
||||||
|
},
|
||||||
|
wantCount: 1,
|
||||||
|
wantDuplicates: 1,
|
||||||
|
wantNewPaths: 0,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
conf := MGConfig{Repos: tt.initial}
|
||||||
|
mergeConf := MGConfig{Repos: tt.merge}
|
||||||
|
|
||||||
|
stats, err := conf.Merge(mergeConf)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Merge() unexpected error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(conf.Repos) != tt.wantCount {
|
||||||
|
t.Errorf("Merge() repo count = %d, want %d", len(conf.Repos), tt.wantCount)
|
||||||
|
}
|
||||||
|
if stats.Duplicates != tt.wantDuplicates {
|
||||||
|
t.Errorf("Merge() duplicates = %d, want %d", stats.Duplicates, tt.wantDuplicates)
|
||||||
|
}
|
||||||
|
if len(stats.NewPaths) != tt.wantNewPaths {
|
||||||
|
t.Errorf("Merge() new paths = %d, want %d", len(stats.NewPaths), tt.wantNewPaths)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGetRepoPaths(t *testing.T) {
|
||||||
|
conf := MGConfig{
|
||||||
|
Repos: []Repo{
|
||||||
|
{Path: "$HOME/code/project1", Remote: "git@github.com:user/project1.git"},
|
||||||
|
{Path: "$HOME/code/project2", Remote: "git@github.com:user/project2.git"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
paths := conf.GetRepoPaths()
|
||||||
|
|
||||||
|
if len(paths) != 2 {
|
||||||
|
t.Fatalf("GetRepoPaths() returned %d paths, want 2", len(paths))
|
||||||
|
}
|
||||||
|
|
||||||
|
expected := []string{"$HOME/code/project1", "$HOME/code/project2"}
|
||||||
|
for i, path := range paths {
|
||||||
|
if path != expected[i] {
|
||||||
|
t.Errorf("GetRepoPaths()[%d] = %q, want %q", i, path, expected[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,6 @@ package parse
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -33,9 +32,9 @@ func (m MRConfig) ToMGConfig() MGConfig {
|
|||||||
mgconf := MGConfig(m)
|
mgconf := MGConfig(m)
|
||||||
for i, repo := range mgconf.Repos {
|
for i, repo := range mgconf.Repos {
|
||||||
checkout := repo.Remote
|
checkout := repo.Remote
|
||||||
if strings.HasPrefix(checkout, "git clone '") {
|
if after, ok := strings.CutPrefix(checkout, "git clone '"); ok {
|
||||||
// git clone 'git@bitbucket.org:taigrr/mg.git' 'mg'
|
// git clone 'git@bitbucket.org:taigrr/mg.git' 'mg'
|
||||||
remote := strings.TrimPrefix(checkout, "git clone '")
|
remote := after
|
||||||
sp := strings.Split(remote, "' '")
|
sp := strings.Split(remote, "' '")
|
||||||
remote = sp[0]
|
remote = sp[0]
|
||||||
mgconf.Repos[i].Remote = remote
|
mgconf.Repos[i].Remote = remote
|
||||||
@@ -60,7 +59,7 @@ func LoadMRConfig() (MRConfig, error) {
|
|||||||
if s.IsDir() {
|
if s.IsDir() {
|
||||||
return MRConfig{}, errors.New("expected mrconfig file but got a directory")
|
return MRConfig{}, errors.New("expected mrconfig file but got a directory")
|
||||||
}
|
}
|
||||||
f, err := ioutil.ReadFile(mrconfPath)
|
f, err := os.ReadFile(mrconfPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return MRConfig{}, err
|
return MRConfig{}, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user