Skip to content

feat: add -account and -list-accounts flags for Amazon#56

Merged
eshaffer321 merged 1 commit into
mainfrom
feat/amazon-account-flag
Jul 2, 2026
Merged

feat: add -account and -list-accounts flags for Amazon#56
eshaffer321 merged 1 commit into
mainfrom
feat/amazon-account-flag

Conversation

@eshaffer321

Copy link
Copy Markdown
Owner

Summary

AMAZON_ACCOUNT_NAME worked but was poor UX for two real usage patterns:

  • Manual one-off runs: you have to remember the env var and the exact profile name, usually by digging through shell history — unlike ./itemize walmart/./itemize costco, which need no extra state.
  • Cron jobs: the account name is hidden in an env var assignment rather than visible in the command itself.

Changes

  • -account <name> flag — overrides AMAZON_ACCOUNT_NAME for a single run (amazon only)
  • -list-accounts flag — scans the browser data directory (~/.itemize/amazon by default) and lists saved profiles, so you don't have to remember exact names:
    $ ./itemize amazon -list-accounts
    Saved Amazon accounts:
      amazon-erick
      amazon-sarah
      amazon-wife
      default
    
    Use with: itemize amazon -account <name>
    
  • The resolved account now prints in the run header (Provider: Amazon | Lookback: 14 days | Account: amazon-wife) so it's never ambiguous which profile a run used
  • AMAZON_ACCOUNT_NAME still works unchanged as the fallback default — existing cron jobs need no changes
  • README documents the new flags under a "Multiple Amazon accounts" section

Files changed

  • internal/cli/flags.go — new flags
  • internal/cli/providers.goNewAmazonProvider takes an account override; new ListAmazonAccounts
  • internal/cli/providers_test.go — new tests for ListAmazonAccounts
  • internal/cli/output.goPrintConfiguration shows the resolved account
  • internal/cli/serve.go — updated call site for the new NewAmazonProvider signature (API server path unaffected, always uses config default)
  • cmd/itemize/main.go — wires -list-accounts short-circuit and passes -account through
  • README.md — usage docs

Verification

  • go build ./..., go vet ./..., go test ./... -race all pass
  • Manually ran ./itemize amazon -list-accounts against real local profiles, confirmed correct output
  • Manually confirmed -list-accounts on walmart/costco exits with a clear error instead of silently doing nothing

AMAZON_ACCOUNT_NAME as an env var was hard to recall for one-off manual
runs (no easy way to see which profiles exist) and hid the account choice
from cron job definitions. -account overrides the env var per-invocation,
and -list-accounts scans the browser data directory for saved profiles so
you don't have to remember exact names. AMAZON_ACCOUNT_NAME still works
unchanged as the default for existing cron setups.
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.95%. Comparing base (ccb6948) to head (9b21c5e).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #56   +/-   ##
=======================================
  Coverage   59.95%   59.95%           
=======================================
  Files          47       47           
  Lines        5262     5262           
=======================================
  Hits         3155     3155           
  Misses       1920     1920           
  Partials      187      187           
Flag Coverage Δ
unittests 59.95% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@eshaffer321 eshaffer321 merged commit 6391e4a into main Jul 2, 2026
14 checks passed
@eshaffer321 eshaffer321 deleted the feat/amazon-account-flag branch July 2, 2026 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant