feat: add -account and -list-accounts flags for Amazon#56
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #56 +/- ##
=======================================
Coverage 59.95% 59.95%
=======================================
Files 47 47
Lines 5262 5262
=======================================
Hits 3155 3155
Misses 1920 1920
Partials 187 187
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AMAZON_ACCOUNT_NAMEworked but was poor UX for two real usage patterns:./itemize walmart/./itemize costco, which need no extra state.Changes
-account <name>flag — overridesAMAZON_ACCOUNT_NAMEfor a single run (amazon only)-list-accountsflag — scans the browser data directory (~/.itemize/amazonby default) and lists saved profiles, so you don't have to remember exact names:Provider: Amazon | Lookback: 14 days | Account: amazon-wife) so it's never ambiguous which profile a run usedAMAZON_ACCOUNT_NAMEstill works unchanged as the fallback default — existing cron jobs need no changesFiles changed
internal/cli/flags.go— new flagsinternal/cli/providers.go—NewAmazonProvidertakes an account override; newListAmazonAccountsinternal/cli/providers_test.go— new tests forListAmazonAccountsinternal/cli/output.go—PrintConfigurationshows the resolved accountinternal/cli/serve.go— updated call site for the newNewAmazonProvidersignature (API server path unaffected, always uses config default)cmd/itemize/main.go— wires-list-accountsshort-circuit and passes-accountthroughREADME.md— usage docsVerification
go build ./...,go vet ./...,go test ./... -raceall pass./itemize amazon -list-accountsagainst real local profiles, confirmed correct output-list-accountsonwalmart/costcoexits with a clear error instead of silently doing nothing