Skip to content

Commit

Permalink
update hofmod-cli, lots of formatting changes, add back ga
Browse files Browse the repository at this point in the history
  • Loading branch information
verdverm committed Aug 15, 2022
1 parent 8c19a21 commit 0f49b4d
Show file tree
Hide file tree
Showing 67 changed files with 1,583 additions and 307 deletions.
155 changes: 69 additions & 86 deletions .hof/shadow/Cli/cmd/hof/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,89 +1,72 @@
project_name: "hof"

builds:
- binary: "hof"
main: main.go

ldflags:
- -s -w
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.Version={{.Version}}
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.Commit={{.FullCommit}}
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.BuildDate={{.Date}}
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.BuildOS={{.Os}}
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.BuildArch={{.Arch}}
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.BuildArm={{.Arm}}

env:
- CGO_ENABLED=0

goos:
- darwin
- linux
- windows
goarch:
- amd64
- arm64

snapshot:
name_template: "{{ .Tag }}-SNAPSHOT-{{.ShortCommit}}"

archives:
- format: binary
replacements:
darwin: Darwin
linux: Linux
windows: Windows
amd64: x86_64
# Needed hack for binary only uploads
# For more information, check #602
files:
- "thisfiledoesnotexist*"


checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt'

- files:
- thisfiledoesnotexist*
format: binary
replacements:
amd64: x86_64
darwin: Darwin
linux: Linux
windows: Windows
builds:
- binary: hof
env:
- CGO_ENABLED=0
goarch:
- amd64
- arm64
goos:
- darwin
- linux
- windows
ldflags:
- -s -w
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.Version={{.Version}}
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.Commit={{.FullCommit}}
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.BuildDate={{.Date}}
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.BuildOS={{.Os}}
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.BuildArch={{.Arch}}
- -X github.com/hofstadter-io/hof/cmd/hof/verinfo.BuildArm={{.Arm}}
main: main.go
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'


release:
disable: false
draft: false
github:
owner: hofstadter-io
name: hof

filters:
exclude:
- '^docs:'
- '^test:'
sort: asc
checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt'
dockers:
- skip_push: false
dockerfile: ../../ci/hof/docker/Dockerfile.debian
image_templates:
- "hofstadter/{{.ProjectName}}:{{.Tag}}"
- "hofstadter/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}"
- "hofstadter/{{.ProjectName}}:v{{ .Major }}"
- "hofstadter/{{.ProjectName}}:latest"

- "hofstadter/{{.ProjectName}}:{{.Tag}}-debian"
- "hofstadter/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}-debian"
- "hofstadter/{{.ProjectName}}:v{{ .Major }}-debian"
- "hofstadter/{{.ProjectName}}:latest-debian"

- skip_push: false
dockerfile: ../../ci/hof/docker/Dockerfile.alpine
image_templates:
- "hofstadter/{{.ProjectName}}:{{.Tag}}-alpine"
- "hofstadter/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}-alpine"
- "hofstadter/{{.ProjectName}}:v{{ .Major }}-alpine"
- "hofstadter/{{.ProjectName}}:latest-alpine"

- skip_push: false
dockerfile: ../../ci/hof/docker/Dockerfile.scratch
image_templates:
- "hofstadter/{{.ProjectName}}:{{.Tag}}-scratch"
- "hofstadter/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}-scratch"
- "hofstadter/{{.ProjectName}}:v{{ .Major }}-scratch"
- "hofstadter/{{.ProjectName}}:latest-scratch"
- dockerfile: ../../ci/hof/docker/Dockerfile.debian
image_templates:
- hofstadter/{{.ProjectName}}:{{.Tag}}
- hofstadter/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}
- hofstadter/{{.ProjectName}}:v{{ .Major }}
- hofstadter/{{.ProjectName}}:latest
- hofstadter/{{.ProjectName}}:{{.Tag}}-debian
- hofstadter/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}-debian
- hofstadter/{{.ProjectName}}:v{{ .Major }}-debian
- hofstadter/{{.ProjectName}}:latest-debian
skip_push: false
- dockerfile: ../../ci/hof/docker/Dockerfile.alpine
image_templates:
- hofstadter/{{.ProjectName}}:{{.Tag}}-alpine
- hofstadter/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}-alpine
- hofstadter/{{.ProjectName}}:v{{ .Major }}-alpine
- hofstadter/{{.ProjectName}}:latest-alpine
skip_push: false
- dockerfile: ../../ci/hof/docker/Dockerfile.scratch
image_templates:
- hofstadter/{{.ProjectName}}:{{.Tag}}-scratch
- hofstadter/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}-scratch
- hofstadter/{{.ProjectName}}:v{{ .Major }}-scratch
- hofstadter/{{.ProjectName}}:latest-scratch
skip_push: false
project_name: hof
release:
disable: false
draft: false
github:
name: hof
owner: hofstadter-io
snapshot:
name_template: '{{ .Tag }}-SNAPSHOT-{{.ShortCommit}}'
18 changes: 16 additions & 2 deletions .hof/shadow/Cli/cmd/hof/cmd/completions.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"os"

"github.com/spf13/cobra"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var (
Expand Down Expand Up @@ -81,7 +83,19 @@ func init() {
help := CompletionCmd.HelpFunc()
usage := CompletionCmd.UsageFunc()

CompletionCmd.SetHelpFunc(help)
CompletionCmd.SetUsageFunc(usage)
thelp := func(cmd *cobra.Command, args []string) {
if CompletionCmd.Name() == cmd.Name() {
ga.SendCommandPath("completion help")
}
help(cmd, args)
}
tusage := func(cmd *cobra.Command) error {
if CompletionCmd.Name() == cmd.Name() {
ga.SendCommandPath("completion usage")
}
return usage(cmd)
}
CompletionCmd.SetHelpFunc(thelp)
CompletionCmd.SetUsageFunc(tusage)

}
20 changes: 18 additions & 2 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"github.com/hofstadter-io/hof/cmd/hof/cmd/datamodel"

"github.com/hofstadter-io/hof/cmd/hof/flags"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var datamodelLong = `Data models are sets of models which are used in many hof processes and modules.
Expand Down Expand Up @@ -42,6 +44,12 @@ var DatamodelCmd = &cobra.Command{
Short: "manage, diff, and migrate your data models",

Long: datamodelLong,

PreRun: func(cmd *cobra.Command, args []string) {

ga.SendCommandPath(cmd.CommandPath())

},
}

func init() {
Expand All @@ -65,8 +73,16 @@ func init() {
return ousage(cmd)
}

DatamodelCmd.SetHelpFunc(help)
DatamodelCmd.SetUsageFunc(usage)
thelp := func(cmd *cobra.Command, args []string) {
ga.SendCommandPath(cmd.CommandPath() + " help")
help(cmd, args)
}
tusage := func(cmd *cobra.Command) error {
ga.SendCommandPath(cmd.CommandPath() + " usage")
return usage(cmd)
}
DatamodelCmd.SetHelpFunc(thelp)
DatamodelCmd.SetUsageFunc(tusage)

DatamodelCmd.AddCommand(cmddatamodel.CheckpointCmd)
DatamodelCmd.AddCommand(cmddatamodel.DiffCmd)
Expand Down
20 changes: 18 additions & 2 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"github.com/spf13/cobra"

"github.com/hofstadter-io/hof/cmd/hof/flags"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var checkpointLong = `create a snapshot of the data model`
Expand Down Expand Up @@ -37,6 +39,12 @@ var CheckpointCmd = &cobra.Command{

Long: checkpointLong,

PreRun: func(cmd *cobra.Command, args []string) {

ga.SendCommandPath(cmd.CommandPath())

},

Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down Expand Up @@ -71,7 +79,15 @@ func init() {
return ousage(cmd)
}

CheckpointCmd.SetHelpFunc(help)
CheckpointCmd.SetUsageFunc(usage)
thelp := func(cmd *cobra.Command, args []string) {
ga.SendCommandPath(cmd.CommandPath() + " help")
help(cmd, args)
}
tusage := func(cmd *cobra.Command) error {
ga.SendCommandPath(cmd.CommandPath() + " usage")
return usage(cmd)
}
CheckpointCmd.SetHelpFunc(thelp)
CheckpointCmd.SetUsageFunc(tusage)

}
20 changes: 18 additions & 2 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"os"

"github.com/spf13/cobra"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var diffLong = `show the diff between data model version`
Expand All @@ -29,6 +31,12 @@ var DiffCmd = &cobra.Command{

Long: diffLong,

PreRun: func(cmd *cobra.Command, args []string) {

ga.SendCommandPath(cmd.CommandPath())

},

Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down Expand Up @@ -63,7 +71,15 @@ func init() {
return ousage(cmd)
}

DiffCmd.SetHelpFunc(help)
DiffCmd.SetUsageFunc(usage)
thelp := func(cmd *cobra.Command, args []string) {
ga.SendCommandPath(cmd.CommandPath() + " help")
help(cmd, args)
}
tusage := func(cmd *cobra.Command) error {
ga.SendCommandPath(cmd.CommandPath() + " usage")
return usage(cmd)
}
DiffCmd.SetHelpFunc(thelp)
DiffCmd.SetUsageFunc(tusage)

}
20 changes: 18 additions & 2 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"os"

"github.com/spf13/cobra"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var historyLong = `list the snapshots for a data model`
Expand All @@ -30,6 +32,12 @@ var HistoryCmd = &cobra.Command{

Long: historyLong,

PreRun: func(cmd *cobra.Command, args []string) {

ga.SendCommandPath(cmd.CommandPath())

},

Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down Expand Up @@ -64,7 +72,15 @@ func init() {
return ousage(cmd)
}

HistoryCmd.SetHelpFunc(help)
HistoryCmd.SetUsageFunc(usage)
thelp := func(cmd *cobra.Command, args []string) {
ga.SendCommandPath(cmd.CommandPath() + " help")
help(cmd, args)
}
tusage := func(cmd *cobra.Command) error {
ga.SendCommandPath(cmd.CommandPath() + " usage")
return usage(cmd)
}
HistoryCmd.SetHelpFunc(thelp)
HistoryCmd.SetUsageFunc(tusage)

}
20 changes: 18 additions & 2 deletions .hof/shadow/Cli/cmd/hof/cmd/datamodel/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"os"

"github.com/spf13/cobra"

"github.com/hofstadter-io/hof/cmd/hof/ga"
)

var infoLong = `print details for a data model`
Expand All @@ -29,6 +31,12 @@ var InfoCmd = &cobra.Command{

Long: infoLong,

PreRun: func(cmd *cobra.Command, args []string) {

ga.SendCommandPath(cmd.CommandPath())

},

Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down Expand Up @@ -63,7 +71,15 @@ func init() {
return ousage(cmd)
}

InfoCmd.SetHelpFunc(help)
InfoCmd.SetUsageFunc(usage)
thelp := func(cmd *cobra.Command, args []string) {
ga.SendCommandPath(cmd.CommandPath() + " help")
help(cmd, args)
}
tusage := func(cmd *cobra.Command) error {
ga.SendCommandPath(cmd.CommandPath() + " usage")
return usage(cmd)
}
InfoCmd.SetHelpFunc(thelp)
InfoCmd.SetUsageFunc(tusage)

}
Loading

0 comments on commit 0f49b4d

Please sign in to comment.