Skip to content

Commit

Permalink
fix: add some details
Browse files Browse the repository at this point in the history
  • Loading branch information
hzxjy1 committed Nov 22, 2023
1 parent 0253623 commit 2d54824
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions maa-cli/src/run/copilot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ pub fn copilot(
stage_dir.push("Arknights-Tile-Pos");
let jpr = "JSON Prase Error";

let copilot_id = link.get(link.len() - 5..).context("Code Invalid")?;
if copilot_id.parse::<f64>().is_err() {
let mut copilot_id = link.trim();
if copilot_id.starts_with("maa://") && copilot_id.parse::<f64>().is_err() {
copilot_id = link.get(link.len() - 5..).context("Code Invalid")?;
} else {
return Err(anyhow!("Code Invalid"));
}

Expand Down Expand Up @@ -76,8 +78,8 @@ pub fn copilot(
}

// Print operators info
let binding = recast["opers"].clone();
let opers = binding.as_array().context(jpr)?;
let opers = recast["opers"].as_array().context(jpr)?;
let groups = recast["groups"].as_array().context(jpr)?;

let mut table = Table::new();
table.set_format(*format::consts::FORMAT_NO_LINESEP_WITH_TITLE);
Expand All @@ -87,6 +89,12 @@ pub fn copilot(
let skill = operator["skill"].as_u64().context(jpr)?;
table.add_row(row![name, skill]);
}

for group in groups {
let name = group["name"].as_str().context(jpr)?;
let skill = "X";
table.add_row(row![name, skill]);
}
normal!("Operator lists:\n", table.to_string());

// Get input of user
Expand Down

0 comments on commit 2d54824

Please sign in to comment.