| 198 | } |
| 199 | |
| 200 | func getStdout(cmd *cobra.Command, src string, recursive bool) error { |
| 201 | if recursive { |
| 202 | return invalidArgumentsErrorWithDetails("`get -` cannot be used with --recursive", mergeJSONErrorDetails(operationErrorDetails("download"), flagErrorDetails("recursive"))) |
| 203 | } |
| 204 | |
| 205 | dbx := filesNewFunc(config) |
| 206 | |
| 207 | meta, err := dbx.GetMetadataContext(currentContext(), files.NewGetMetadataArg(src)) |
| 208 | if err == nil { |
| 209 | if _, ok := meta.(*files.FolderMetadata); ok { |
| 210 | return invalidArgumentsErrorfWithDetails("%s is a folder; cannot download folder to stdout", mergeJSONErrorDetails(operationErrorDetails("download"), pathErrorDetails(src)), src) |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | return withJSONErrorDetails(downloadToStdout(dbx, src, cmd.OutOrStdout()), operationErrorDetails("download"), pathErrorDetails(src)) |
| 215 | } |
| 216 | |
| 217 | func getWithClient(dbx filesClient, args []string) (err error) { |
| 218 | if len(args) == 0 || len(args) > 2 { |