sq/cli/cmd_list.go

25 lines
484 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)
return cmd
2020-08-06 20:58:47 +03:00
}
func execSrcList(cmd *cobra.Command, args []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
}