Be more explicit about device management
This commit is contained in:
parent
82babf0ce6
commit
afc81e3b95
1 changed files with 38 additions and 26 deletions
14
src/main.zig
14
src/main.zig
|
|
@ -413,7 +413,13 @@ pub fn main() !void {
|
|||
}
|
||||
try stdout.flush();
|
||||
|
||||
if (result.devices.len > 0) {
|
||||
switch (result.devices.len) {
|
||||
0 => {
|
||||
try stderr.print("❌ No devices found for user\n", .{});
|
||||
try stderr.flush();
|
||||
return error.NoDevicesFound;
|
||||
},
|
||||
1 => {
|
||||
const device = result.devices[0];
|
||||
|
||||
if (device.serial_id) |sid| {
|
||||
|
|
@ -440,5 +446,11 @@ pub fn main() !void {
|
|||
try stderr.flush();
|
||||
return error.NoSerialId;
|
||||
}
|
||||
},
|
||||
else => {
|
||||
try stderr.print("❌ More than one device found for user, not currently equipped to handle this\n", .{});
|
||||
try stderr.flush();
|
||||
return error.TooManyDevicesFound;
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue