Skip to content

Commit

Permalink
temp: start transition
Browse files Browse the repository at this point in the history
  • Loading branch information
telemachus committed Dec 5, 2024
1 parent 8914a40 commit f3c2f80
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
7 changes: 7 additions & 0 deletions internal/cli/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ func (app *appEnv) noOp() bool {
return app.exitValue != exitSuccess
}

func alternativeNewAppEnv(cmd string) *appEnv {
return &appEnv{
cmd: cmd,
exitValue: exitSucess,

Check failure on line 28 in internal/cli/app.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.22 on ubuntu-latest)

undefined: exitSucess

Check failure on line 28 in internal/cli/app.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.23 on ubuntu-latest)

undefined: exitSucess

Check failure on line 28 in internal/cli/app.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.22 on macos-latest)

undefined: exitSucess

Check failure on line 28 in internal/cli/app.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.23 on macos-latest)

undefined: exitSucess

Check failure on line 28 in internal/cli/app.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.22 on windows-latest)

undefined: exitSucess

Check failure on line 28 in internal/cli/app.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.23 on windows-latest)

undefined: exitSucess
}
}

func newAppEnv(cfg *cfg) *appEnv {
homeDir, err := os.UserHomeDir()
if err != nil {
Expand Down
14 changes: 8 additions & 6 deletions internal/cli/gitmirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ func Gitmirror(args []string) int {
return app.exitValue
}

// TODO: rename appFromArgs?
func parse(args []string) (*cfg, error) {
op := optionparser.NewOptionParser()
cfg := &cfg{cmd: cmd}
op.On("-c", "--config", "Use this config file (default ~/.gitmirror.json)", &cfg.cfgFile)
op.On("-q", "--quiet", "Only print error messages", &cfg.quiet)
app := alternativeNewAppEnv(cmd)
op.On("-c", "--config", "Use this config file (default ~/.gitmirror.json)", &app.cfgFile)
op.On("-q", "--quiet", "Only print error messages", &app.quiet)
op.On("--version", "Print version and exit", version)
op.Command("clone", "Clone git repositories using `git clone --mirror`")
op.Command("update", "Update git repositories using `git remote update`")
Expand All @@ -71,9 +72,10 @@ func parse(args []string) (*cfg, error) {
return nil, err
}

cfg.subCmd = op.Extra[0]
if cfg.cfgFile == "" {
cfg.defaultCfgFile = true
app.subCmd = op.Extra[0]
// TODO: Fix this
if app.cfgFile == "" {
app.defaultCfgFile = true

Check failure on line 78 in internal/cli/gitmirror.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.22 on ubuntu-latest)

app.defaultCfgFile undefined (type *appEnv has no field or method defaultCfgFile)

Check failure on line 78 in internal/cli/gitmirror.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.23 on ubuntu-latest)

app.defaultCfgFile undefined (type *appEnv has no field or method defaultCfgFile)

Check failure on line 78 in internal/cli/gitmirror.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.22 on macos-latest)

app.defaultCfgFile undefined (type *appEnv has no field or method defaultCfgFile)

Check failure on line 78 in internal/cli/gitmirror.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.23 on macos-latest)

app.defaultCfgFile undefined (type *appEnv has no field or method defaultCfgFile)

Check failure on line 78 in internal/cli/gitmirror.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.22 on windows-latest)

app.defaultCfgFile undefined (type *appEnv has no field or method defaultCfgFile)

Check failure on line 78 in internal/cli/gitmirror.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.23 on windows-latest)

app.defaultCfgFile undefined (type *appEnv has no field or method defaultCfgFile)
cfg.cfgFile = defaultCfgFile

Check failure on line 79 in internal/cli/gitmirror.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.22 on ubuntu-latest)

cfg.cfgFile undefined (type cfg has no method cfgFile)

Check failure on line 79 in internal/cli/gitmirror.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.23 on ubuntu-latest)

cfg.cfgFile undefined (type cfg has no method cfgFile)

Check failure on line 79 in internal/cli/gitmirror.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.22 on macos-latest)

cfg.cfgFile undefined (type cfg has no method cfgFile)

Check failure on line 79 in internal/cli/gitmirror.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.23 on macos-latest)

cfg.cfgFile undefined (type cfg has no method cfgFile)

Check failure on line 79 in internal/cli/gitmirror.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.22 on windows-latest)

cfg.cfgFile undefined (type cfg has no method cfgFile)

Check failure on line 79 in internal/cli/gitmirror.go

View workflow job for this annotation

GitHub Actions / humane test (using go 1.23 on windows-latest)

cfg.cfgFile undefined (type cfg has no method cfgFile)
}

Expand Down

0 comments on commit f3c2f80

Please sign in to comment.