mirror of
https://github.com/neilotoole/sq.git
synced 2024-12-19 06:01:36 +03:00
26 lines
547 B
Go
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)
|
|
}
|