MCPcopy Create free account
hub / github.com/peak/s5cmd / buildSelect

Function buildSelect

command/select.go:52–95  ·  view source on GitHub ↗
(c *cli.Context, inputFormat string, inputStructure *string)

Source from the content-addressed store, hash-verified

50}
51
52func 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
97func NewSelectCommand() *cli.Command {
98 sharedFlags := []cli.Flag{

Callers 1

NewSelectCommandFunction · 0.85

Calls 10

CollectFunction · 0.92
NewFunction · 0.92
WithVersionFunction · 0.92
WithRawFunction · 0.92
WithAllVersionsFunction · 0.92
commandFromContextFunction · 0.85
printErrorFunction · 0.85
NewStorageOptsFunction · 0.85
GetMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected