sq/cli/cmd_list.go
Neil O'Toole 58ccfc9ded
Json driver; refactoring of core packages (#66)
* Type Detector refactor

* json driver impl; refactoring of source.Files reader et al

* working on kind detector

* significant switcheroo of packages

* partway throught refactoring Kind

* major package switcheroo for Kind
2020-08-23 04:42:15 -06:00

27 lines
586 B
Go

package cli
import (
"github.com/spf13/cobra"
"github.com/neilotoole/sq/libsq/core/errz"
)
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)
}
return rc.writers.srcw.SourceSet(rc.Config.Sources)
}