fix(sheets): avoid --json flag collision
This commit is contained in:
parent
720dec78ee
commit
eedfba8a5f
@ -16,6 +16,7 @@
|
||||
### Fixed
|
||||
|
||||
- Gmail: `gog gmail attachment` download now works reliably; avoid re-fetching payload for filename inference and accept padded base64 responses.
|
||||
- Sheets: avoid flag collision with global `--json`; values input flag is now `--values-json` for `sheets update|append`.
|
||||
|
||||
### Changed
|
||||
|
||||
|
||||
@ -376,7 +376,7 @@ gog sheets export <spreadsheetId> --format xlsx --out ./sheet.xlsx
|
||||
|
||||
# Write
|
||||
gog sheets update <spreadsheetId> 'A1' 'val1|val2,val3|val4'
|
||||
gog sheets update <spreadsheetId> 'A1' --json '[["a","b"],["c","d"]]'
|
||||
gog sheets update <spreadsheetId> 'A1' --values-json '[["a","b"],["c","d"]]'
|
||||
gog sheets append <spreadsheetId> 'Sheet1!A:C' 'new|row|data'
|
||||
gog sheets clear <spreadsheetId> 'Sheet1!A1:B10'
|
||||
|
||||
|
||||
@ -124,7 +124,7 @@ func Execute(args []string) error {
|
||||
|
||||
root.SetArgs(args)
|
||||
root.PersistentFlags().StringVar(&flags.Color, "color", flags.Color, "Color output: auto|always|never")
|
||||
root.PersistentFlags().StringVar(&flags.Account, "account", "", "Account email for API commands (gmail/calendar/drive/contacts/tasks/people/sheets)")
|
||||
root.PersistentFlags().StringVar(&flags.Account, "account", "", "Account email for API commands (gmail/calendar/drive/docs/slides/contacts/tasks/people/sheets)")
|
||||
root.PersistentFlags().BoolVar(&flags.JSON, "json", flags.JSON, "Output JSON to stdout (best for scripting)")
|
||||
root.PersistentFlags().BoolVar(&flags.Plain, "plain", flags.Plain, "Output stable, parseable text to stdout (TSV; no colors)")
|
||||
root.PersistentFlags().BoolVar(&flags.Force, "force", false, "Skip confirmations for destructive commands")
|
||||
|
||||
@ -129,12 +129,12 @@ Values can be provided as:
|
||||
1. Command line args (comma-separated rows, pipe-separated cells):
|
||||
gog sheets update ID 'A1' 'a|b|c,d|e|f' (2 rows, 3 cols each)
|
||||
|
||||
2. JSON via --json flag:
|
||||
gog sheets update ID 'A1' --json '[["a","b"],["c","d"]]'
|
||||
2. JSON via --values-json flag:
|
||||
gog sheets update ID 'A1' --values-json '[["a","b"],["c","d"]]'
|
||||
|
||||
Examples:
|
||||
gog sheets update 1BxiMVs... 'Sheet1!A1' 'Hello|World'
|
||||
gog sheets update 1BxiMVs... 'Sheet1!A1:B2' --json '[["a","b"],["c","d"]]'`,
|
||||
gog sheets update 1BxiMVs... 'Sheet1!A1:B2' --values-json '[["a","b"],["c","d"]]'`,
|
||||
Args: cobra.MinimumNArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
u := ui.FromContext(cmd.Context())
|
||||
@ -165,7 +165,7 @@ Examples:
|
||||
values = append(values, rowData)
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("provide values as args or via --json")
|
||||
return fmt.Errorf("provide values as args or via --values-json")
|
||||
}
|
||||
|
||||
svc, err := newSheetsService(cmd.Context(), account)
|
||||
@ -203,7 +203,7 @@ Examples:
|
||||
}
|
||||
|
||||
cmd.Flags().StringVar(&valueInputOption, "input", "USER_ENTERED", "Value input option: RAW or USER_ENTERED")
|
||||
cmd.Flags().StringVar(&jsonValues, "json", "", "Values as JSON 2D array")
|
||||
cmd.Flags().StringVar(&jsonValues, "values-json", "", "Values as JSON 2D array")
|
||||
return cmd
|
||||
}
|
||||
|
||||
@ -221,7 +221,7 @@ Values format same as 'update' command.
|
||||
|
||||
Examples:
|
||||
gog sheets append 1BxiMVs... 'Sheet1!A:C' 'val1|val2|val3'
|
||||
gog sheets append 1BxiMVs... 'Sheet1!A:C' --json '[["a","b","c"]]'`,
|
||||
gog sheets append 1BxiMVs... 'Sheet1!A:C' --values-json '[["a","b","c"]]'`,
|
||||
Args: cobra.MinimumNArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
u := ui.FromContext(cmd.Context())
|
||||
@ -251,7 +251,7 @@ Examples:
|
||||
values = append(values, rowData)
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("provide values as args or via --json")
|
||||
return fmt.Errorf("provide values as args or via --values-json")
|
||||
}
|
||||
|
||||
svc, err := newSheetsService(cmd.Context(), account)
|
||||
@ -293,7 +293,7 @@ Examples:
|
||||
|
||||
cmd.Flags().StringVar(&valueInputOption, "input", "USER_ENTERED", "Value input option: RAW or USER_ENTERED")
|
||||
cmd.Flags().StringVar(&insertDataOption, "insert", "", "Insert data option: OVERWRITE or INSERT_ROWS")
|
||||
cmd.Flags().StringVar(&jsonValues, "json", "", "Values as JSON 2D array")
|
||||
cmd.Flags().StringVar(&jsonValues, "values-json", "", "Values as JSON 2D array")
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user