MCPcopy Index your code
hub / github.com/cloudquery/cloudquery / tables

Function tables

cli/cmd/tables.go:43–143  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

41}
42
43func tables(cmd *cobra.Command, args []string) error {
44 cqDir, err := cmd.Flags().GetString("cq-dir")
45 if err != nil {
46 return err
47 }
48
49 format, err := cmd.Flags().GetString("format")
50 if err != nil {
51 return err
52 }
53 outputDir, err := cmd.Flags().GetString("output-dir")
54 if err != nil {
55 return err
56 }
57 filter, err := cmd.Flags().GetString("filter")
58 if err != nil {
59 return err
60 }
61 ctx := cmd.Context()
62 log.Info().Strs("args", args).Msg("Loading spec(s)")
63 fmt.Printf("Loading spec(s) from %s\n", strings.Join(args, ", "))
64 specReader, err := specs.NewRelaxedSpecReader(args)
65 if err != nil {
66 return fmt.Errorf("failed to load spec(s) from %s. Error: %w", strings.Join(args, ", "), err)
67 }
68 sources := specReader.Sources
69 authToken, err := auth.GetAuthTokenIfNeeded(log.Logger, sources, nil, nil)
70 if err != nil {
71 return fmt.Errorf("failed to get auth token: %w", err)
72 }
73 teamName, err := auth.GetTeamForToken(ctx, authToken)
74 if err != nil {
75 return fmt.Errorf("failed to get team name: %w", err)
76 }
77
78 pluginVersionWarner, _ := managedplugin.NewPluginVersionWarner(log.Logger, authToken.Value)
79 specs.WarnOnOutdatedVersions(ctx, pluginVersionWarner, sources, nil, nil)
80
81 opts := []managedplugin.Option{
82 managedplugin.WithLogger(log.Logger),
83 managedplugin.WithAuthToken(authToken.Value),
84 managedplugin.WithTeamName(teamName),
85 }
86 if logConsole {
87 opts = append(opts, managedplugin.WithNoProgress())
88 }
89 if cqDir != "" {
90 opts = append(opts, managedplugin.WithDirectory(cqDir))
91 }
92 if disableSentry {
93 opts = append(opts, managedplugin.WithNoSentry())
94 }
95 pluginConfigs := make([]managedplugin.Config, len(sources))
96 sourceRegInferred := make([]bool, len(sources))
97 for i, sourceSpec := range sources {
98 pluginConfigs[i] = managedplugin.Config{
99 Name: sourceSpec.Name,
100 Path: sourceSpec.Path,

Callers

nothing calls this directly

Calls 9

SpecRegistryToPluginFunction · 0.85
enrichClientErrorFunction · 0.85
findMaxCommonVersionFunction · 0.85
tablesV3Function · 0.85
tablesV2Function · 0.85
PrintfMethod · 0.80
ErrorfMethod · 0.80
PrintlnMethod · 0.80
ContextMethod · 0.45

Tested by

no test coverage detected