fix: try fix errors
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 4s
CI Workflow / CI run tests (pull_request) Failing after 24m39s
CI Workflow / CI run build and linting (pull_request) Successful in 24m55s
CI Workflow / Code coverage report (pull_request) Successful in 4s
CI Workflow / Test readiness for publishing provider (pull_request) Has been cancelled
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 4s
CI Workflow / CI run tests (pull_request) Failing after 24m39s
CI Workflow / CI run build and linting (pull_request) Successful in 24m55s
CI Workflow / Code coverage report (pull_request) Successful in 4s
CI Workflow / Test readiness for publishing provider (pull_request) Has been cancelled
This commit is contained in:
parent
f05e90c35a
commit
a560cb434a
9 changed files with 441 additions and 32 deletions
115
cmd/cmd/examplesCmd.go
Normal file
115
cmd/cmd/examplesCmd.go
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var examplesCmd = &cobra.Command{
|
||||
Use: "examples",
|
||||
Short: "create examples",
|
||||
Long: `...`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
||||
//filePathStr := "stackit/internal/services/postgresflexalpha/database/datasources_gen/database_data_source_gen.go"
|
||||
//
|
||||
//src, err := os.ReadFile(filePathStr)
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
//
|
||||
//i := interp.New(
|
||||
// interp.Options{
|
||||
// GoPath: "/home/henselinm/.asdf/installs/golang/1.25.6/packages",
|
||||
// BuildTags: nil,
|
||||
// Stdin: nil,
|
||||
// Stdout: nil,
|
||||
// Stderr: nil,
|
||||
// Args: nil,
|
||||
// Env: nil,
|
||||
// SourcecodeFilesystem: nil,
|
||||
// Unrestricted: false,
|
||||
// },
|
||||
//)
|
||||
//err = i.Use(i.Symbols("github.com/hashicorp/terraform-plugin-framework-validators"))
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
//err = i.Use(stdlib.Symbols)
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
//_, err = i.Eval(string(src))
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
//
|
||||
//v, err := i.Eval("DatabaseDataSourceSchema")
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
//
|
||||
//bar := v.Interface().(func(string) string)
|
||||
//
|
||||
//r := bar("Kung")
|
||||
//println(r)
|
||||
//
|
||||
//evalPath, err := i.EvalPath(filePathStr)
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
//
|
||||
//fmt.Printf("%+v\n", evalPath)
|
||||
|
||||
//_, err = i.Eval(`import "fmt"`)
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
//_, err = i.Eval(`func Hallo() { fmt.Println("Hi!") }`)
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
|
||||
//v = i.Symbols("Hallo")
|
||||
|
||||
// fmt.Println(v)
|
||||
return workServices()
|
||||
},
|
||||
}
|
||||
|
||||
func workServices() error {
|
||||
startPath := path.Join("stackit", "internal", "services")
|
||||
|
||||
services, err := os.ReadDir(startPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, entry := range services {
|
||||
if !entry.IsDir() {
|
||||
continue
|
||||
}
|
||||
resources, err := os.ReadDir(path.Join(startPath, entry.Name()))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, res := range resources {
|
||||
if !res.IsDir() {
|
||||
continue
|
||||
}
|
||||
fmt.Println("Gefunden:", startPath, "subdir", entry.Name(), "resource", res.Name())
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewExamplesCmd() *cobra.Command {
|
||||
return examplesCmd
|
||||
}
|
||||
|
||||
//func init() { // nolint: gochecknoinits
|
||||
// examplesCmd.Flags().BoolVarP(&example, "example", "e", false, "example")
|
||||
//}
|
||||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"log/slog"
|
||||
"os"
|
||||
|
||||
"github.com/MatusOllah/slogcolor"
|
||||
"github.com/SladkyCitron/slogcolor"
|
||||
cc "github.com/ivanpirog/coloredcobra"
|
||||
|
||||
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/cmd/cmd"
|
||||
|
|
@ -30,6 +30,7 @@ func main() {
|
|||
cmd.NewBuildCmd(),
|
||||
cmd.NewPublishCmd(),
|
||||
cmd.NewGetFieldsCmd(),
|
||||
cmd.NewExamplesCmd(),
|
||||
)
|
||||
|
||||
err := rootCmd.Execute()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue