fix(sheets): support file input for values#1193
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR extends the ChangesSheet Values Flag Input Sources
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
sheets +write --valuesandsheets +append --valuesto use existing shortcut input conventions:@fileand-for stdin.Root cause
sheets +write/+appendparsed the raw--valuesflag directly withjson.Unmarshal, but the flag did not opt into the shortcut framework input resolver. As a result,--values @values.jsonwas parsed literally as JSON and failed with--values invalid JSON, must be a 2D array.Reproduction
Before the fix,
lark-cli sheets +write --spreadsheet-token sht_test --range sheet1!A1 --values @./values.json --dry-runfailed with--values invalid JSON, must be a 2D array. With this branch, the same command resolves the file and includes the loaded 2D array in the dry-run body.Validation
go test ./shortcuts/sheets -run "TestSheetWriteDryRunAcceptsValuesFileInput|TestSheetAppendDryRunAcceptsValuesStdinInput|TestCellDataValidateRejectsNon2DValues" -count=1go test ./shortcuts/sheets -count=1go build -o /tmp/lark-cli-sheets-values .--values @fileand--values -Notes
go test ./...was also run. It failed in unrelated environment-dependent suites: schema tests could not find generated registry services such asim; e2e tests required a repo-root./lark-clibinary and live Feishu app scopes such ascalendar:calendar:read/space:folder:create.Summary by CodeRabbit
valuesparameter. Users can provide JSON directly, load data from files (using@file), or read from standard input (using -). This enables more convenient ways to supply large or dynamically generated datasets to spreadsheet operations.