Skip to content

Commit

Permalink
feat: almost ready for v1.0.0
Browse files Browse the repository at this point in the history
TODO:

+ Move flag parsing code to internal/cli/flag.go and rename the function
  to Parse.
+ Make the configuration json a proper object rather than only an array.
+ Move configuration unmarshaling code to internal/cli/config.go and
  rename the function Load.
+ Look for other parts of the internal code that I can make private.
  • Loading branch information
telemachus committed Nov 25, 2024
1 parent aae258c commit d6ffc0c
Show file tree
Hide file tree
Showing 28 changed files with 601 additions and 276 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
gitmirror
/gitmirror
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.DEFAULT_GOAL := test

PREFIX := $(HOME)/local/gitmirror

fmt:
golangci-lint run --disable-all --no-config -Egofmt --fix
golangci-lint run --disable-all --no-config -Egofumpt --fix
Expand All @@ -8,21 +10,25 @@ lint: fmt
golangci-lint run

test:
go test -shuffle on github.com/telemachus/gitmirror/cli
go test -shuffle on github.com/telemachus/gitmirror/internal/cli
go test -shuffle on github.com/telemachus/gitmirror/internal/git

testv:
go test -shuffle on -v github.com/telemachus/gitmirror/cli
go test -shuffle on -v github.com/telemachus/gitmirror/internal/cli
go test -shuffle on -v github.com/telemachus/gitmirror/internal/git

testr:
go test -race -shuffle on github.com/telemachus/gitmirror/cli
go test -race -shuffle on github.com/telemachus/gitmirror/internal/cli
go test -race -shuffle on github.com/telemachus/gitmirror/internal/git

build: lint testr
go build .
go build ./cmd/gitmirror

install: build
go install .
go install ./cmd/gitmirror

clean:
rm -f gitmirror
go clean -i -r -cache

.PHONY: fmt lint build install test testv testr clean
11 changes: 11 additions & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# TODO

## Clean up

This works now as a single command, but there’s a lot of overlapping
responsibilities and cruft.

+ How should I handle the command and subcommand names? (Store them in the app?
Store them as package constants? Something else?)
+ What is the responsibility of the app versus just a function call?
+ Maybe I can handle flags and flag-parsing better?
189 changes: 0 additions & 189 deletions cli/app.go

This file was deleted.

34 changes: 0 additions & 34 deletions cli/result.go

This file was deleted.

31 changes: 0 additions & 31 deletions cli/run.go

This file was deleted.

11 changes: 11 additions & 0 deletions cmd/gitmirror/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package main

import (
"os"

"github.com/telemachus/gitmirror/internal/cli"
)

func main() {
os.Exit(cli.CmdGitmirror(os.Args[1:]))
}
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ module github.com/telemachus/gitmirror

go 1.23

require github.com/google/go-cmp v0.6.0
require (
github.com/MakeNowJust/heredoc v1.0.0
github.com/google/go-cmp v0.6.0
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ=
github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
Loading

0 comments on commit d6ffc0c

Please sign in to comment.