function runHealthCheck()

in torchlive-cli/src/cli-commands/Doctor.ts [95:147]


function runHealthCheck(healthCheck: IHealthCheck, ind: number = 2): void {
  const command = healthCheck.getCommand();
  console.log(`${indent(ind - 2)}${chalk.green(healthCheck.getTitle())}`);
  if (healthCheck.getShouldRemove()) {
    if (!command.isInstalled()) {
      console.log(`${indent(ind)}✅ package does not exist.`);
    } else {
      console.log(`${indent(ind)}📍 path: ${command.getPath()}`);
      console.log(`${indent(ind)}🚫 package should not exist, please remove.`);
    }
    console.log();
    return;
  }
  if (command.isInstalled()) {
    console.log(`${indent(ind)}📍 path: ${command.getPath()}`);
    if (!command.isVersionless()) {
      if (healthCheck.getMinVersion() !== null) {
        console.log(
          `${indent(ind)}🏁 min version: ${healthCheck.getMinVersion()}`,
        );
      }
      console.log(
        `${indent(ind)}${
          healthCheck.satisfies() ? '✅' : '🚫'
        } version: ${command.getVersion()}`,
      );
    }

    if (healthCheck.hasPackages()) {
      console.log();
      console.log(`${indent(ind)}${chalk.green('Required Android Packages')}`);
      healthCheck.checkPackages().forEach(pkgInfo => {
        console.log(
          `${indent(ind + 2)}📦 ${pkgInfo.satisfies ? '✅' : '❌'} ${
            pkgInfo.package.path
          } ${
            pkgInfo.package.version != null
              ? `(${pkgInfo.package.version})`
              : ''
          }`,
        );
      });
      console.log();
      console.log(`${indent(ind)}${chalk.green('Installed Android Packages')}`);
      healthCheck.getInstalledPackages().forEach(pkg => {
        console.log(`${indent(ind + 2)}📦 ${pkg.path} (${pkg.version})`);
      });
    }
  } else {
    console.log(`${indent(ind)}🚫 not installed`);
  }
  console.log();
}