How to use the cli-color.bold function in cli-color

To help you get started, we’ve selected a few cli-color examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github firebase / firebase-tools / src / extensions / listExtensions.ts View on Github external
style: { head: ["yellow"] },
  });

  // Order instances newest to oldest.
  const sorted = _.sortBy(instances, "createTime", "asc").reverse();
  sorted.forEach((instance) => {
    table.push([
      _.last(instance.name.split("/")),
      instance.state,
      _.get(instance, "config.source.spec.version", ""),
      instance.createTime,
      instance.updateTime,
    ]);
  });

  utils.logLabeledBullet(logPrefix, `list of extensions installed in ${clc.bold(projectId)}:`);
  logger.info(table.toString());
  return { instances: sorted };
}
github StreetStrider / repl.js / src / functools.js View on Github external
functools.signature = function signature (fn, bodyToo)
{
	var
		view  = fn.toString(),
		match = reFunction.exec(view),
		out;

	if (match)
	{
		if (bodyToo)
		{
			out = clc.bold(match[1]) + match[2];
		}
		else
		{
			out = clc.bold(match[1].trim());
		}
		console.log(out);
	}
};
github silklabs / silk / cli / src / logs.js View on Github external
export function warn (message: string) {
  console.error(`[${colors.bold(NAME)}] ${colors.redBright('WARN')} : ${message}`);
}
github firebase / firebase-tools / src / commands / ext-uninstall.ts View on Github external
);
        if (_.get(saDeletionRes, "body.error")) {
          if (_.get(saDeletionRes, "body.error.code") === 404) {
            spinner.succeed(
              ` ${clc.green.bold(logPrefix)}: service account ${clc.bold(
                instance.serviceAccountEmail
              )} was previously deleted.`
            );
          } else {
            throw new FirebaseError("Unable to delete service account", {
              original: saDeletionRes.body.error,
            });
          }
        } else {
          spinner.succeed(
            ` ${clc.green.bold(logPrefix)}: deleted service account ${clc.bold(
              instance.serviceAccountEmail
            )}`
          );
        }
      }
    } catch (err) {
      if (spinner.isSpinning) {
        spinner.fail();
      }
      if (err instanceof FirebaseError) {
        throw err;
      }
      return utils.reject(`Error occurred uninstalling extension ${instanceId}`, { original: err });
    }
    utils.logLabeledSuccess(logPrefix, `uninstalled ${instanceId}`);
  });
github firebase / firebase-tools / src / getProjectId.js View on Github external
module.exports = function(options, allowNull) {
  if (!options.project && !allowNull) {
    var aliases = _.get(options, "rc.projects", {});
    var aliasCount = _.size(aliases);

    if (aliasCount === 0) {
      throw new FirebaseError(
        "No project active. Run with " +
          clc.bold("--project ") +
          " or define an alias by\nrunning " +
          clc.bold("firebase use --add"),
        {
          exit: 1,
        }
      );
    } else {
      var aliasList = _.map(aliases, function(projectId, aname) {
        return "  " + aname + " (" + projectId + ")";
      }).join("\n");

      throw new FirebaseError(
        "No project active, but project aliases are available.\n\nRun " +
          clc.bold("firebase use ") +
          " with one of these options:\n\n" +
          aliasList
github firebase / firebase-tools / src / runtimeChoiceSelector.ts View on Github external
nodejs8: "Node.js 8",
  nodejs10: "Node.js 10 (Beta)",
};

const ENGINE_RUNTIMES: { [key: string]: string } = {
  6: "nodejs6",
  8: "nodejs8",
  10: "nodejs10",
};

export const ENGINES_FIELD_REQUIRED_MSG = clc.bold(
  "Engines field is required in package.json but none was found."
);
export const UNSUPPORTED_NODE_VERSION_MSG = clc.bold(
  `package.json in functions directory has an engines field which is unsupported. ` +
    `The only valid choices are: ${clc.bold('{"node": "8"}')} and ${clc.bold('{"node": "10"}')}. ` +
    `Note that Node.js 6 is now deprecated.`
);
export const DEPRECATION_WARNING_MSG =
  clc.bold.yellow("functions: ") +
  "Deploying functions to Node 6 runtime, which is deprecated. Node 8 is available " +
  "and is the recommended runtime.";

export const FUNCTIONS_SDK_VERSION_TOO_OLD_WARNING =
  clc.bold.yellow("functions: ") +
  "You must have a " +
  clc.bold("firebase-functions") +
  " version that is at least 2.0.0. Please run " +
  clc.bold("npm i --save firebase-functions@latest") +
  " in the functions folder.";

/**
github firebase / firebase-tools / src / commands / functions-config-clone.js View on Github external
return functionsConfigClone(options.from, projectId, only, except).then(function() {
      utils.logSuccess(
        "Cloned functions config from " + clc.bold(options.from) + " into " + clc.bold(projectId)
      );
      logger.info(
        "\nPlease deploy your functions for the change to take effect by running " +
          clc.bold("firebase deploy --only functions") +
          "\n"
      );
    });
  });
github firebase / firebase-tools / commands / experimental-database-emulate.js View on Github external
.action(function(options) {
    if (options.config) {
      logger.info();
      logger.info(
        clc.bold(clc.white("===") + " Serving from '" + options.config.projectDir + "'...")
      );
      logger.info();
    } else {
      utils.logWarning(
        "No Firebase project directory detected. Serving static content from " +
          clc.bold(options.cwd || process.cwd())
      );
    }
    options.targets = ["database"];
    return emulator(options);
  });
github firebase / firebase-tools / src / commands / login.js View on Github external
.action(function(options) {
    if (options.nonInteractive) {
      return utils.reject(
        "Cannot run login in non-interactive mode. See " +
          clc.bold("login:ci") +
          " to generate a token for use in non-interactive environments.",
        { exit: 1 }
      );
    }

    var user = configstore.get("user");
    var tokens = configstore.get("tokens");

    if (user && tokens && !options.reauth) {
      logger.info("Already logged in as", clc.bold(user.email));
      return Promise.resolve(user);
    }

    utils.logBullet(
      "Firebase optionally collects CLI usage and error reporting information to help improve our products. Data is collected in accordance with Google's privacy policy (https://policies.google.com/privacy) and is not used to identify you.\n"
    );
github firebase / firebase-tools / src / commands / use.js View on Github external
var verifyMessage = function(name) {
  return "please verify project " + clc.bold(name) + " exists and you have access.";
};