MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / FormatterOptionsFromConfig

Function FormatterOptionsFromConfig

cmd/gosqlx/cmd/formatter.go:267–303  ·  view source on GitHub ↗

FormatterOptionsFromConfig creates CLIFormatterOptions from config and CLI flags

(cfg *config.Config, flagsChanged map[string]bool, flags FormatterFlags)

Source from the content-addressed store, hash-verified

265
266// FormatterOptionsFromConfig creates CLIFormatterOptions from config and CLI flags
267func FormatterOptionsFromConfig(cfg *config.Config, flagsChanged map[string]bool, flags FormatterFlags) CLIFormatterOptions {
268 opts := CLIFormatterOptions{
269 IndentSize: cfg.Format.Indent,
270 Uppercase: cfg.Format.UppercaseKeywords,
271 Compact: cfg.Format.Compact,
272 MaxLine: cfg.Format.MaxLineLength,
273 Verbose: cfg.Output.Verbose,
274 }
275
276 // Override with CLI flags if explicitly set
277 if flagsChanged["in-place"] {
278 opts.InPlace = flags.InPlace
279 }
280 if flagsChanged["indent"] {
281 opts.IndentSize = flags.IndentSize
282 }
283 if flagsChanged["uppercase"] || flagsChanged["no-uppercase"] {
284 opts.Uppercase = flags.Uppercase
285 }
286 if flagsChanged["compact"] {
287 opts.Compact = flags.Compact
288 }
289 if flagsChanged["check"] {
290 opts.Check = flags.Check
291 }
292 if flagsChanged["max-line"] {
293 opts.MaxLine = flags.MaxLine
294 }
295 if flagsChanged["verbose"] {
296 opts.Verbose = flags.Verbose
297 }
298 if flagsChanged["output"] {
299 opts.Output = flags.Output
300 }
301
302 return opts
303}

Callers 3

formatRunFunction · 0.85
formatFromStdinFunction · 0.85
formatInlineSQLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected