Skip to content

Refactor oa2csv flags to Config struct#14

Merged
rustyeddy merged 3 commits intomainfrom
copilot/refactor-flag-variables-to-config
Jan 27, 2026
Merged

Refactor oa2csv flags to Config struct#14
rustyeddy merged 3 commits intomainfrom
copilot/refactor-flag-variables-to-config

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 27, 2026

Consolidates 9 scattered flag variables in cmd/oa2csv/main.go into a single Config struct for better organization and maintainability.

Changes

  • Added Config struct with fields for all CLI parameters (Env, Token, Instrument, Granularity, Price, FromStr, ToStr, OutPath, CompleteOnly)
  • Migrated flag declarations from flag.String() return values to flag.StringVar() populating struct fields
  • Updated references throughout main() from pointer dereferencing (*token) to struct field access (cfg.Token)

Before:

var (
    env = flag.String("env", "practice", "...")
    token = flag.String("token", "", "...")
    // ... 7 more flags
)
flag.Parse()
if *token == "" {
    *token = os.Getenv("OANDA_TOKEN")
}

After:

cfg := &Config{}
flag.StringVar(&cfg.Env, "env", "practice", "...")
flag.StringVar(&cfg.Token, "token", "", "...")
// ... 7 more flags
flag.Parse()
if cfg.Token == "" {
    cfg.Token = os.Getenv("OANDA_TOKEN")
}

CLI interface remains unchanged.

Original prompt

This section details on the original issue you should resolve

<issue_title>All flags need to use Config files.</issue_title>
<issue_description>Turn flag variables into config structures.</issue_description>

<agent_instructions>Make all the flag variables in cmd/oa2csv/main.go info a single struct `type Config struct {...}. </agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: rustyeddy <2903425+rustyeddy@users.noreply.github.com>
@rustyeddy rustyeddy marked this pull request as ready for review January 27, 2026 07:04
Copilot AI review requested due to automatic review settings January 27, 2026 07:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: rustyeddy <2903425+rustyeddy@users.noreply.github.com>
@rustyeddy rustyeddy added the enhancement New feature or request label Jan 27, 2026
Copilot AI changed the title [WIP] Turn flag variables into config structures Refactor oa2csv flags to Config struct Jan 27, 2026
Copilot AI requested a review from rustyeddy January 27, 2026 07:06
@rustyeddy rustyeddy merged commit 1fa8c8e into main Jan 27, 2026
@rustyeddy rustyeddy deleted the copilot/refactor-flag-variables-to-config branch January 27, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

All flags need to use Config files.

3 participants