delta icon indicating copy to clipboard operation
delta copied to clipboard

Work in Progress: Initial implementation of `--doctor` command

Open clnoll opened this issue 3 years ago • 3 comments

This is an initial version of the --doctor command, which will check various settings of a user's environment and identify possible incompatibilities with delta.

This PR is intended to show a potential pattern for adding new --doctor checks, so I've intentionally kept the list of handled checks short, in anticipation of structural changes that are suggested during code review.

The suggested pattern for adding new checks is to add a new struct that implements the Diagnostic trait, comprised of the following methods:

  • diagnose: gets the setting in the user's environment, and compares it to allowed settings. Returns a Health object with a diagnosis & remedy if the setting is potentially incompatible with delta.
  • remedy: Suggests a remedy, if the Health object returned by diagnose indicates that the setting may be incompatible.
  • report: Reports the value of the setting, whether or not it is "healthy".

Currently, delta --doctor prints the report to stdout.

Addresses https://github.com/dandavison/delta/issues/1184.

clnoll avatar Sep 15 '22 17:09 clnoll

Thanks for the review @dandavison! I made the updates you suggested.

clnoll avatar Nov 23 '22 18:11 clnoll

Rebased on master

dandavison avatar Jul 29 '23 17:07 dandavison