(c *cli.Context, inputFormat string, inputStructure *string)
| 50 | } |
| 51 | |
| 52 | func buildSelect(c *cli.Context, inputFormat string, inputStructure *string) (cmd *Select, err error) { |
| 53 | defer stat.Collect(c.Command.FullName(), &err)() |
| 54 | |
| 55 | fullCommand := commandFromContext(c) |
| 56 | |
| 57 | src, err := url.New( |
| 58 | c.Args().Get(0), |
| 59 | url.WithVersion(c.String("version-id")), |
| 60 | url.WithRaw(c.Bool("raw")), |
| 61 | url.WithAllVersions(c.Bool("all-versions")), |
| 62 | ) |
| 63 | |
| 64 | if err != nil { |
| 65 | printError(fullCommand, c.Command.Name, err) |
| 66 | return nil, err |
| 67 | } |
| 68 | |
| 69 | outputFormat := c.String("output-format") |
| 70 | if c.String("output-format") == "" { |
| 71 | outputFormat = inputFormat |
| 72 | } |
| 73 | |
| 74 | cmd = &Select{ |
| 75 | src: src, |
| 76 | op: c.Command.Name, |
| 77 | fullCommand: fullCommand, |
| 78 | // flags |
| 79 | inputFormat: inputFormat, |
| 80 | outputFormat: outputFormat, |
| 81 | query: c.String("query"), |
| 82 | compressionType: c.String("compression"), |
| 83 | exclude: c.StringSlice("exclude"), |
| 84 | forceGlacierTransfer: c.Bool("force-glacier-transfer"), |
| 85 | ignoreGlacierWarnings: c.Bool("ignore-glacier-warnings"), |
| 86 | |
| 87 | storageOpts: NewStorageOpts(c), |
| 88 | } |
| 89 | |
| 90 | // parquet files don't have an input structure |
| 91 | if inputStructure != nil { |
| 92 | cmd.inputStructure = *inputStructure |
| 93 | } |
| 94 | return cmd, nil |
| 95 | } |
| 96 | |
| 97 | func NewSelectCommand() *cli.Command { |
| 98 | sharedFlags := []cli.Flag{ |
no test coverage detected