Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 12 additions & 0 deletions cmd/config/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package config

import (
"github.com/spf13/cobra"
)

// ConfigCmd represents the config subcommand.
var ConfigCmd = &cobra.Command{
Use: "config",
Short: "Manage the forge.yaml configuration",
Long: `Commands for initializing and formatting the forge.yaml configuration file.`,
}
15 changes: 7 additions & 8 deletions cmd/confmt.go → cmd/config/fmt.go
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
package cmd
package config

import (
"fmt"

"github.com/spf13/cobra"

"github.com/gomicro/forge/confile"
"github.com/spf13/cobra"
)

func init() {
RootCmd.AddCommand(confmtCmd)
ConfigCmd.AddCommand(fmtCmd)
}

var confmtCmd = &cobra.Command{
Use: "confmt",
var fmtCmd = &cobra.Command{
Use: "fmt",
Short: "Format the forge.yaml config file",
Long: `Rewrite forge.yaml in the current directory in canonical format.`,
RunE: confmtFunc,
RunE: fmtFunc,
}

func confmtFunc(cmd *cobra.Command, args []string) error {
func fmtFunc(cmd *cobra.Command, args []string) error {
conf, err := confile.ParseFromFile()
if err != nil {
return fmt.Errorf("parsing config file: %w", err)
Expand Down
7 changes: 3 additions & 4 deletions cmd/init.go → cmd/config/init.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package cmd
package config

import (
"errors"
"fmt"
"os"
"path"

"github.com/spf13/cobra"

"github.com/gomicro/forge/confile"
"github.com/spf13/cobra"
)

func init() {
RootCmd.AddCommand(initCmd)
ConfigCmd.AddCommand(initCmd)
}

var initCmd = &cobra.Command{
Expand Down
3 changes: 3 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"sort"

"github.com/gomicro/forge/cmd/config"
"github.com/gomicro/forge/confile"
"github.com/gomicro/scribe"
"github.com/spf13/cobra"
Expand All @@ -15,6 +16,8 @@ import (
func init() {
cobra.OnInitialize(initEnvs)

RootCmd.AddCommand(config.ConfigCmd)

RootCmd.PersistentFlags().Bool("verbose", false, "show more verbose output")
err := viper.BindPFlag("verbose", RootCmd.PersistentFlags().Lookup("verbose"))
if err != nil {
Expand Down
33 changes: 15 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,26 @@ go 1.23.3

require (
github.com/gomicro/scribe v0.0.0-20250818044048-c8eae6079552
github.com/spf13/cobra v1.2.1
github.com/spf13/viper v1.8.1
github.com/spf13/cobra v1.10.2
github.com/spf13/viper v1.21.0
github.com/stretchr/testify v1.11.1
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.3.6 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.28.0 // indirect
)
628 changes: 43 additions & 585 deletions go.sum

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions vendor/github.com/fsnotify/fsnotify/.cirrus.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion vendor/github.com/fsnotify/fsnotify/.gitattributes

This file was deleted.

14 changes: 9 additions & 5 deletions vendor/github.com/fsnotify/fsnotify/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions vendor/github.com/fsnotify/fsnotify/.mailmap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 0 additions & 36 deletions vendor/github.com/fsnotify/fsnotify/.travis.yml

This file was deleted.

52 changes: 0 additions & 52 deletions vendor/github.com/fsnotify/fsnotify/AUTHORS

This file was deleted.

Loading
Loading