sq/cli/cmd_list.go

27 lines
586 B
Go
Raw Normal View History

2020-08-06 20:58:47 +03:00
package cli
import (
"github.com/spf13/cobra"
"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
}