Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,10 @@ Example output for `agent status`:

```bash
# List crash reports from a device
mobilecli crashes list --device <device-id>
mobilecli device crashes list --device <device-id>

# Get a specific crash report by ID
mobilecli crashes get <crash-id> --device <device-id>
mobilecli device crashes get <crash-id> --device <device-id>
```

Example output for `crashes list`:
Expand Down
5 changes: 3 additions & 2 deletions cli/crashes.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
)

var crashesCmd = &cobra.Command{
Use: "crashes",
Short: "Manage crash reports from devices",
Use: "crashes",
Short: "Manage crash reports from devices",
Deprecated: "use 'device crashes' instead",
}

var crashesListCmd = &cobra.Command{
Expand Down
50 changes: 50 additions & 0 deletions cli/device_crashes.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package cli

import (
"fmt"

"github.com/mobile-next/mobilecli/commands"
"github.com/spf13/cobra"
)

var deviceCrashesCmd = &cobra.Command{
Use: "crashes",
Short: "Manage crash reports from a device",
}

var deviceCrashesListCmd = &cobra.Command{
Use: "list",
Short: "List crash reports from a device",
RunE: func(cmd *cobra.Command, args []string) error {
response := commands.CrashesListCommand(deviceId)
printJson(response)
if response.Status == "error" {
return fmt.Errorf("%s", response.Error)
}
return nil
},
}

var deviceCrashesGetCmd = &cobra.Command{
Use: "get [id]",
Short: "Get a crash report by ID",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
response := commands.CrashesGetCommand(deviceId, args[0])
printJson(response)
if response.Status == "error" {
return fmt.Errorf("%s", response.Error)
}
return nil
},
}

func init() {
deviceCmd.AddCommand(deviceCrashesCmd)

deviceCrashesCmd.AddCommand(deviceCrashesListCmd)
deviceCrashesCmd.AddCommand(deviceCrashesGetCmd)

deviceCrashesListCmd.Flags().StringVar(&deviceId, "device", "", "ID of the device to list crashes from")
deviceCrashesGetCmd.Flags().StringVar(&deviceId, "device", "", "ID of the device to get crash from")
}
4 changes: 2 additions & 2 deletions cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ INPUT/OUTPUT:
CRASH REPORTS:
# List crash reports from a device
mobilecli crashes list --device <device-id>
mobilecli device crashes list --device <device-id>
# Get a specific crash report
mobilecli crashes get --device <device-id> <crash-id>
mobilecli device crashes get --device <device-id> <crash-id>
AGENT:
# Check agent installation status
Expand Down
Loading