(cmd *cobra.Command, args []string)
| 185 | } |
| 186 | |
| 187 | func fileInfoRun(cmd *cobra.Command, args []string) error { |
| 188 | path, err := fixRelativePaths(args[0]) |
| 189 | if err != nil { |
| 190 | return err |
| 191 | } |
| 192 | fileData := wshrpc.FileData{ |
| 193 | Info: &wshrpc.FileInfo{ |
| 194 | Path: path}} |
| 195 | |
| 196 | info, err := wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout}) |
| 197 | err = convertNotFoundErr(err) |
| 198 | if err != nil { |
| 199 | return fmt.Errorf("getting file info: %w", err) |
| 200 | } |
| 201 | |
| 202 | if info.NotFound { |
| 203 | return fmt.Errorf("%s: no such file", path) |
| 204 | } |
| 205 | |
| 206 | WriteStdout("name:\t%s\n", info.Name) |
| 207 | if info.Mode != 0 { |
| 208 | WriteStdout("mode:\t%s\n", info.Mode.String()) |
| 209 | } |
| 210 | WriteStdout("mtime:\t%s\n", time.Unix(info.ModTime/1000, 0).Format(time.DateTime)) |
| 211 | if !info.IsDir { |
| 212 | WriteStdout("size:\t%d\n", info.Size) |
| 213 | } |
| 214 | if info.Meta != nil && len(*info.Meta) > 0 { |
| 215 | WriteStdout("metadata:\n") |
| 216 | for k, v := range *info.Meta { |
| 217 | WriteStdout("\t\t\t%s: %v\n", k, v) |
| 218 | } |
| 219 | } |
| 220 | return nil |
| 221 | } |
| 222 | |
| 223 | func fileRmRun(cmd *cobra.Command, args []string) error { |
| 224 | path, err := fixRelativePaths(args[0]) |
nothing calls this directly
no test coverage detected