sourcegraph/dev/sg/internal
Bolaji Olajide 4d57eb1188
fix(sg): make sg gen output more readable (#64406)
Closes DINF-78

The output of `sg gen` is a bit hard to read when there's an error, this
is because the new line character `\n` isn't rendered as a new line. It
turns out the `%q` formatting directive used to quote a string doesn't
render the `\n` character as a new line.

| Before |
|---|
| ![CleanShot 2024-08-12 at 11 17
57@2x](https://github.com/user-attachments/assets/e03ec503-e437-4b68-80b3-fe34ac8848fb)
|

| After  |
|---|
| ![CleanShot 2024-08-12 at 10 53
35@2x](https://github.com/user-attachments/assets/5b7aac63-27b6-4de0-9c56-3b739f0ee0f9)
|

I also added a func to extract error messages from a bazel command to
avoid long output message when a bazel command fails and give the user
relevant messages related to the error.

| Before  |
|---|


https://github.com/user-attachments/assets/2d029ec1-5804-41bf-a675-8642e169ea80


| After  |
|---|
| ![CleanShot 2024-08-12 at 14 45
59@2x](https://github.com/user-attachments/assets/7d567fd6-de37-48aa-b2b5-03dc591fc77a)
|

## Test plan

<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->

* Manual testing

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-08-13 06:22:21 -05:00
..
analytics feat(sg): report user os information via analytics (#64280) 2024-08-06 17:31:50 -05:00
background feat(sg): sqlite-backed local store for sg analytics (#63578) 2024-07-09 12:47:49 +02:00
backport fix(ci): check command out for error when git fails (#63993) 2024-07-23 09:56:33 -05:00
bk fix(build-tracker): Failed back-compat doesn't count towards branch-locking quota (#63911) 2024-07-25 06:45:09 -05:00
category sg msp: initial prototype (#55905) 2023-09-07 17:24:34 -07:00
check Update the legacy link to sg doc (#64017) 2024-08-01 16:18:30 -07:00
cloud sg/cloud: fix eph cmd typo (#64427) 2024-08-13 06:53:07 +02:00
db bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
docker bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
execute fix(ci): check command out for error when git fails (#63993) 2024-07-23 09:56:33 -05:00
generate fix(sg): make sg gen output more readable (#64406) 2024-08-13 06:22:21 -05:00
images bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
migration fix(sg): make sg gen output more readable (#64406) 2024-08-13 06:22:21 -05:00
open bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
release fix(ci): check command out for error when git fails (#63993) 2024-07-23 09:56:33 -05:00
repo feature/release: update sg release cut to automate stitch graph gen and release branch creation (#63794) 2024-07-18 23:15:04 -07:00
rfc bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
run fix(sg): make sg gen output more readable (#64406) 2024-08-13 06:22:21 -05:00
secrets feat/sg: do not persist external secrets (#63890) 2024-07-18 10:04:24 -07:00
sgconf chore(local): rename experiment single-program commandset (#64341) 2024-08-08 13:55:06 +02:00
slack bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
std sg/msp: fix init prompts breaking when encountering whitespace (#62898) 2024-05-24 15:08:35 +01:00
usershell bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
wolfi bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00