(args: &[String], cwd: &Path)
| 806 | fn count_braces_outside_strings(line: &str) -> (usize, usize) { |
| 807 | let mut escaped = false; |
| 808 | let mut in_string = false; |
| 809 | let mut open = 0usize; |
| 810 | let mut close = 0usize; |
| 811 | for ch in line.chars() { |
| 812 | if escaped { |
| 813 | escaped = false; |
| 814 | continue; |
| 815 | } |
| 816 | match ch { |
| 817 | '\\' if in_string => escaped = true, |
| 818 | '"' => in_string = !in_string, |
| 819 | '{' if !in_string => open += 1, |
| 820 | '}' if !in_string => close += 1, |
| 821 | _ => {} |
| 822 | } |
| 823 | } |
| 824 | (open, close) |
| 825 | } |
| 826 | |
| 827 | fn indent(out: &mut String, depth: usize) { |
| 828 | for _ in 0..depth { |
| 829 | out.push_str(" "); |
| 830 | } |
| 831 | } |
| 832 | |
| 833 | pub(crate) fn project_command(args: &[String], cwd: &Path) -> Result<(), String> { |
| 834 | let target = parse_cli_target(args)?; |
| 835 | let native_target = parse_flag_value(args, "--triple"); |
| 836 | let universal_macos = args.iter().any(|a| a == "--universal-macos"); |
| 837 | if (native_target.is_some() || universal_macos) && target != CliTarget::Native { |
| 838 | return Err("`--triple` + `--universal-macos` only support `--target native`".to_string()); |
no test coverage detected