ParserOptionsFromConfig creates CLIParserOptions from config and CLI flags
(cfg *config.Config, flagsChanged map[string]bool, flags ParserFlags)
| 374 | |
| 375 | // ParserOptionsFromConfig creates CLIParserOptions from config and CLI flags |
| 376 | func ParserOptionsFromConfig(cfg *config.Config, flagsChanged map[string]bool, flags ParserFlags) CLIParserOptions { |
| 377 | opts := CLIParserOptions{ |
| 378 | Format: cfg.Output.Format, |
| 379 | Verbose: cfg.Output.Verbose, |
| 380 | } |
| 381 | |
| 382 | // Override with CLI flags if explicitly set |
| 383 | if flagsChanged["ast"] { |
| 384 | opts.ShowAST = flags.ShowAST |
| 385 | } |
| 386 | if flagsChanged["tokens"] { |
| 387 | opts.ShowTokens = flags.ShowTokens |
| 388 | } |
| 389 | if flagsChanged["tree"] { |
| 390 | opts.TreeView = flags.TreeView |
| 391 | } |
| 392 | if flagsChanged["format"] { |
| 393 | opts.Format = flags.Format |
| 394 | } |
| 395 | if flagsChanged["verbose"] { |
| 396 | opts.Verbose = flags.Verbose |
| 397 | } |
| 398 | |
| 399 | return opts |
| 400 | } |
no outgoing calls
no test coverage detected