mirror of
https://github.com/eiskasten/wc-beacon.git
synced 2026-09-09 12:55:09 -05:00
Print error in main
This commit is contained in:
13
src/main.rs
13
src/main.rs
@@ -34,20 +34,17 @@ pub mod speciesmap {
|
||||
///
|
||||
/// Parses command-line arguments using the `Cli` struct, and then executes
|
||||
/// the appropriate command based on the parsed input.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// Returns `Ok(())` if the program runs successfully, otherwise returns an
|
||||
/// error wrapped in a `Box<dyn Error>`.
|
||||
///
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
fn main() {
|
||||
let cli = Cli::parse();
|
||||
match cli.command {
|
||||
let res = match cli.command {
|
||||
Command::Distribute { pcd, region, device, address, interval } =>
|
||||
distribute(pcd, region, device, address.unwrap_or([0xa4, 0xc0, 0xe1, 0x6e, 0x76, 0x80]), interval),
|
||||
Command::Decrypt { epcd, checksum, address, pcd } => decrypt(epcd, checksum, address, pcd),
|
||||
Command::Info { pcd } => info(pcd),
|
||||
Command::Set { title, kind: card_type, gift_instance, card_id, games, description: comment, redistribution, icons, pgt, date: received, pcd, output } => set(title, card_type, card_id, gift_instance, games, comment, redistribution, icons, pgt, received, pcd, output)
|
||||
};
|
||||
if let Err(err) = res {
|
||||
eprintln!("Error: {}", err);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -300,12 +300,8 @@ impl PCD<Deserialized> {
|
||||
|
||||
let icons = [des.icons.0,des.icons.1,des.icons.2].iter().flat_map(|i|i.to_le_bytes()).collect::<Vec<u8>>();
|
||||
|
||||
eprintln!("{:?} {:?}", des.icons, icons);
|
||||
|
||||
card_data[PCD_ICONS_OFFSET - PCD_COMMENT_OFFSET..PCD_ICONS_OFFSET - PCD_COMMENT_OFFSET + 2*3].copy_from_slice(icons.as_slice());
|
||||
|
||||
eprintln!("{:?}", &card_data[PCD_ICONS_OFFSET-PCD_COMMENT_OFFSET..PCD_ICONS_OFFSET-PCD_COMMENT_OFFSET+2*3]);
|
||||
|
||||
card_data[PCD_RECEIVED_OFFSET - PCD_COMMENT_OFFSET..PCD_RECEIVED_OFFSET - PCD_COMMENT_OFFSET + 2].copy_from_slice(&des.received.to_le_bytes());
|
||||
card_data[PCD_REDISTRIBUTION_OFFSET - PCD_COMMENT_OFFSET] = des.redistribution;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user