2020-08-06 20:58:47 +03:00
|
|
|
package cli
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
2020-08-23 13:42:15 +03:00
|
|
|
"github.com/neilotoole/sq/libsq/core/errz"
|
2020-08-06 20:58:47 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func newSrcListCmd() (*cobra.Command, runFunc) {
|
|
|
|
cmd := &cobra.Command{
|
|
|
|
Use: "ls",
|
|
|
|
Short: "List data sources",
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd.Flags().BoolP(flagVerbose, flagVerboseShort, false, flagVerboseUsage)
|
|
|
|
cmd.Flags().BoolP(flagHeader, flagHeaderShort, false, flagHeaderUsage)
|
|
|
|
return cmd, execSrcList
|
|
|
|
}
|
|
|
|
|
|
|
|
func execSrcList(rc *RunContext, cmd *cobra.Command, args []string) error {
|
|
|
|
if len(args) != 0 {
|
|
|
|
return errz.Errorf(msgInvalidArgs)
|
|
|
|
}
|
|
|
|
|
2020-08-08 06:06:56 +03:00
|
|
|
return rc.writers.srcw.SourceSet(rc.Config.Sources)
|
2020-08-06 20:58:47 +03:00
|
|
|
}
|