(cmd *cobra.Command, args []string)
| 239 | } |
| 240 | |
| 241 | func fileWriteRun(cmd *cobra.Command, args []string) error { |
| 242 | path, err := fixRelativePaths(args[0]) |
| 243 | if err != nil { |
| 244 | return err |
| 245 | } |
| 246 | fileData := wshrpc.FileData{ |
| 247 | Info: &wshrpc.FileInfo{ |
| 248 | Path: path}} |
| 249 | |
| 250 | limitReader := io.LimitReader(WrappedStdin, MaxFileSize+1) |
| 251 | data, err := io.ReadAll(limitReader) |
| 252 | if err != nil { |
| 253 | return fmt.Errorf("reading input: %w", err) |
| 254 | } |
| 255 | if len(data) > MaxFileSize { |
| 256 | return fmt.Errorf("input exceeds maximum file size of %d bytes", MaxFileSize) |
| 257 | } |
| 258 | fileData.Data64 = base64.StdEncoding.EncodeToString(data) |
| 259 | err = wshclient.FileWriteCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout}) |
| 260 | if err != nil { |
| 261 | return fmt.Errorf("writing file: %w", err) |
| 262 | } |
| 263 | |
| 264 | return nil |
| 265 | } |
| 266 | |
| 267 | func fileAppendRun(cmd *cobra.Command, args []string) error { |
| 268 | path, err := fixRelativePaths(args[0]) |
nothing calls this directly
no test coverage detected