sq/cli/cmd_list.go
2023-04-01 02:38:32 -06:00

26 lines
547 B
Go

package cli
import (
"github.com/spf13/cobra"
)
func newSrcListCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "ls",
Short: "List data sources",
Long: "List data sources.",
Args: cobra.ExactArgs(0),
RunE: execSrcList,
}
cmd.Flags().BoolP(flagHeader, flagHeaderShort, false, flagHeaderUsage)
cmd.Flags().BoolP(flagJSON, flagJSONShort, false, flagJSONUsage)
return cmd
}
func execSrcList(cmd *cobra.Command, _ []string) error {
rc := RunContextFrom(cmd.Context())
return rc.writers.srcw.SourceSet(rc.Config.Sources)
}