2020-08-06 20:58:47 +03:00
|
|
|
package cli
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2021-02-22 10:37:00 +03:00
|
|
|
func newSrcListCmd() *cobra.Command {
|
2020-08-06 20:58:47 +03:00
|
|
|
cmd := &cobra.Command{
|
|
|
|
Use: "ls",
|
|
|
|
Short: "List data sources",
|
2022-12-25 07:04:18 +03:00
|
|
|
Long: "List data sources.",
|
2021-02-22 10:37:00 +03:00
|
|
|
Args: cobra.ExactArgs(0),
|
|
|
|
RunE: execSrcList,
|
2020-08-06 20:58:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
cmd.Flags().BoolP(flagHeader, flagHeaderShort, false, flagHeaderUsage)
|
2023-01-01 06:17:44 +03:00
|
|
|
cmd.Flags().BoolP(flagJSON, flagJSONShort, false, flagJSONUsage)
|
2021-02-22 10:37:00 +03:00
|
|
|
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 {
|
2021-02-22 10:37:00 +03:00
|
|
|
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
|
|
|
}
|