sq/cli/cmd_list.go

26 lines
547 B
Go
Raw Normal View History

2020-08-06 20:58:47 +03:00
package cli
import (
"github.com/spf13/cobra"
)
func newSrcListCmd() *cobra.Command {
2020-08-06 20:58:47 +03:00
cmd := &cobra.Command{
Use: "ls",
Short: "List data sources",
Long: "List data sources.",
Args: cobra.ExactArgs(0),
RunE: execSrcList,
2020-08-06 20:58:47 +03:00
}
cmd.Flags().BoolP(flagHeader, flagHeaderShort, false, flagHeaderUsage)
cmd.Flags().BoolP(flagJSON, flagJSONShort, false, flagJSONUsage)
return cmd
2020-08-06 20:58:47 +03:00
}
2023-04-01 11:38:32 +03:00
func execSrcList(cmd *cobra.Command, _ []string) error {
rc := RunContextFrom(cmd.Context())
2020-08-06 20:58:47 +03:00
2020-08-08 06:06:56 +03:00
return rc.writers.srcw.SourceSet(rc.Config.Sources)
2020-08-06 20:58:47 +03:00
}