main.go 846 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package main
  4. import (
  5. "flag"
  6. "fmt"
  7. "os"
  8. "path/filepath"
  9. "github.com/open-telemetry/opentelemetry-collector-contrib/cmd/configschema/cfgmetadatagen/cfgmetadatagen"
  10. "github.com/open-telemetry/opentelemetry-collector-contrib/internal/components"
  11. )
  12. func main() {
  13. sourceDir, outputDir := getFlags()
  14. c, err := components.Components()
  15. if err != nil {
  16. fmt.Printf("error getting components %v", err)
  17. os.Exit(1)
  18. }
  19. err = cfgmetadatagen.GenerateFiles(c, sourceDir, outputDir)
  20. if err != nil {
  21. fmt.Printf("cfg metadata generator failed: %v\n", err)
  22. }
  23. }
  24. func getFlags() (string, string) {
  25. sourceDir := flag.String("s", filepath.Join("..", ".."), "")
  26. outputDir := flag.String("o", "cfg-metadata", "output dir")
  27. flag.Parse()
  28. return *sourceDir, *outputDir
  29. }