oscope-dev / scope

Scoping user machines
https://oscope-dev.github.io/scope/
BSD 3-Clause "New" or "Revised" License
6 stars 3 forks source link

Improve UX by reducing output #99

Closed ethankhall closed 6 months ago

ethankhall commented 7 months ago

The goal of this code is to enable --progress as a root logging option. By default, if scope is run within a tty then the only real output should be progress bar updates.

This change also removes many of the logging options to support only -v / --verbose option. By default we'll log much less.

With this, we're able to write to stdout without needing to go through tracing, removing some of the formatting requirements.

With this change, we're adding support for report_stdout! which will allow developers to write to stdout. This returns a future, so all calls need to be async. It will also "log" the line, so the output will show up in logs.

Output

New CLI options

Options:
  -v, --verbose...
          A level of verbosity, and can be used multiple times

      --progress <PROGRESS>
          Set the progress output. Use plain to disable updating UI

          [env: SCOPE_OUTPUT_PROGRESS=]
          [default: auto]

          Possible values:
          - auto:  Determine output format based on execution context
          - plain: Standard output, no progress bar, no auto-updating output
          - tty:   Use progress bar

demo1 demo2

noizwaves commented 6 months ago

On this version, the final output of the command is empty. It does show the intermediate in progress output, but there is no "Done" / checklist style list of what was checked:

❯ scope doctor run

❯ echo $?
0

I didn't really expect this, but re-reviewing this PR, I see that may have been intended.

technicalpickles commented 6 months ago

This looks nice! I think I agree w/ Adam that is is a little surprising to have empty result when there is nothing to do.

Maybe a lefthook-style summary would be appropriate? ie how many fixed, how long it took, etc

ethankhall commented 6 months ago

@technicalpickles i added a summary in https://github.com/oscope-dev/scope/pull/102