Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: add human-readable error when [build] script exits with 1 #513

Open
chicoxyzzy opened this issue Aug 1, 2023 · 2 comments
Open

CLI: add human-readable error when [build] script exits with 1 #513

chicoxyzzy opened this issue Aug 1, 2023 · 2 comments
Labels
cli enhancement New feature or request good first issue Good for newcomers

Comments

@chicoxyzzy
Copy link
Member

No description provided.

@chicoxyzzy chicoxyzzy added enhancement New feature or request good first issue Good for newcomers cli labels Aug 1, 2023
@chicoxyzzy
Copy link
Member Author

How about this?

Old:
image

New:

image

@chicoxyzzy
Copy link
Member Author

chicoxyzzy commented Aug 9, 2023

I'll save my code here:

String wrapInASCIIBox(const String& text) {
  Vector<String> lines;
  std::istringstream iss(text);
  String line;

  size_t max_length = 0;
  while (std::getline(iss, line)) {
    lines.push_back(line);
    if (line.size() > max_length) {
      max_length = line.size();
    }
  }

  String topBottomBorder = "+" + String(max_length + 2, '-') + "+";
  String result = topBottomBorder + "\n";

  for (const auto& l : lines) {
    result += "| " + l + String(max_length - l.size(), ' ') + " |\n";
  }

  result += topBottomBorder + "\n";
  return result;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant