mirror of
https://github.com/neilotoole/sq.git
synced 2024-12-26 17:51:34 +03:00
58ccfc9ded
* 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
31 lines
804 B
Go
31 lines
804 B
Go
package cli
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/neilotoole/sq/libsq/core/errz"
|
|
)
|
|
|
|
func newDriversCmd() (*cobra.Command, runFunc) {
|
|
cmd := &cobra.Command{
|
|
Use: "drivers",
|
|
Short: "List available drivers",
|
|
}
|
|
|
|
cmd.Flags().BoolP(flagJSON, flagJSONShort, false, flagJSONUsage)
|
|
cmd.Flags().BoolP(flagTable, flagTableShort, false, flagTableUsage)
|
|
cmd.Flags().BoolP(flagHeader, flagHeaderShort, false, flagHeaderUsage)
|
|
cmd.Flags().BoolP(flagMonochrome, flagMonochromeShort, false, flagMonochromeUsage)
|
|
|
|
return cmd, execDrivers
|
|
}
|
|
|
|
func execDrivers(rc *RunContext, cmd *cobra.Command, args []string) error {
|
|
if len(args) > 0 {
|
|
return errz.Errorf("invalid arguments: zero arguments expected")
|
|
}
|
|
|
|
drvrs := rc.registry.DriversMetadata()
|
|
return rc.writers.metaw.DriverMetadata(drvrs)
|
|
}
|