本文整理汇总了TypeScript中chalk.dim函数的典型用法代码示例。如果您正苦于以下问题:TypeScript dim函数的具体用法?TypeScript dim怎么用?TypeScript dim使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dim函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
program.on('--help', () => {
console.log(
`
Supported Apps:
ImageAlpha: ${chalk.blue.underline('https://pngmini.com')}
ImageOptim: ${chalk.blue.underline('https://imageoptim.com')}
JPEGmini Lite: ${chalk.blue.underline(
'https://itunes.apple.com/us/app/jpegmini-lite/id525742250'
)}
JPEGmini Pro: ${chalk.blue.underline(
'https://itunes.apple.com/us/app/jpegmini-pro/id887163276'
)}
JPEGmini: ${chalk.blue.underline('https://itunes.apple.com/us/app/jpegmini/id498944723')}
Examples:
${chalk.dim('Run ImageOptim.app over every image in current directory')}
imageoptim
${chalk.dim('Run ImageAlpha.app and ImageOptim.app over every PNG in current directory')}
imageoptim --imagealpha '**/*.png'
${chalk.dim('Run JPEGmini.app and ImageOptim.app over every JPG in current directory')}
imageoptim --jpegmini '**/*.jpg' '**/*.jpeg'
${chalk.dim('Run JPEGmini.app over every JPG in current directory')}
imageoptim --jpegmini --no-imageoptim '**/*.jpg' '**/*.jpeg'
${chalk.dim('Run ImageOptim.app over every image in a specific directory')}
imageoptim '~/Desktop'
`.trimRight()
);
});
开发者ID:JamieMason,项目名称:ImageOptim-CLI,代码行数:34,代码来源:imageoptim.ts
示例2: _drawUIDoneWithSkipped
private _drawUIDoneWithSkipped() {
this._pipe.write(CLEAR);
const numPass = this._countPaths - this._testAssertions.length;
let stats = chalk.bold.dim(
pluralize('snapshot', this._countPaths) + ' reviewed',
);
if (numPass) {
stats +=
', ' + chalk.bold.green(pluralize('snapshot', numPass) + ' updated');
}
if (this._skippedNum) {
stats +=
', ' +
chalk.bold.yellow(pluralize('snapshot', this._skippedNum) + ' skipped');
}
const messages = [
'\n' + chalk.bold('Interactive Snapshot Result'),
ARROW + stats,
'\n' + chalk.bold('Watch Usage'),
chalk.dim(ARROW + 'Press ') +
'r' +
chalk.dim(' to restart Interactive Snapshot Mode.'),
chalk.dim(ARROW + 'Press ') +
'q' +
chalk.dim(' to quit Interactive Snapshot Mode.'),
];
this._pipe.write(messages.filter(Boolean).join('\n') + '\n');
}
开发者ID:Volune,项目名称:jest,代码行数:32,代码来源:SnapshotInteractiveMode.ts
示例3: slash
return buffer.reduce((output, {type, message, origin}) => {
origin = slash(path.relative(root, origin));
message = message
.split(/\n/)
.map(line => CONSOLE_INDENT + line)
.join('\n');
let typeMessage = 'console.' + type;
if (type === 'warn') {
message = chalk.yellow(message);
typeMessage = chalk.yellow(typeMessage);
} else if (type === 'error') {
message = chalk.red(message);
typeMessage = chalk.red(typeMessage);
}
return (
output +
TITLE_INDENT +
chalk.dim(typeMessage) +
' ' +
chalk.dim(origin) +
'\n' +
message +
'\n'
);
}, '');
开发者ID:elliottsj,项目名称:jest,代码行数:27,代码来源:getConsoleOutput.ts
示例4: Promise
new Promise((resolve, reject) => {
if (typeof stdin.setRawMode === 'function') {
const messages = [
chalk.red('There are deprecation warnings.\n'),
chalk.dim(' \u203A Press ') + 'Enter' + chalk.dim(' to continue.'),
chalk.dim(' \u203A Press ') + 'Esc' + chalk.dim(' to exit.'),
];
pipe.write(messages.join('\n'));
stdin.setRawMode(true);
stdin.resume();
stdin.setEncoding('utf8');
stdin.on('data', key => {
if (key === KEYS.ENTER) {
resolve();
} else if (
[KEYS.ESCAPE, KEYS.CONTROL_C, KEYS.CONTROL_D].indexOf(key) !== -1
) {
reject();
}
});
} else {
resolve();
}
});
开发者ID:Volune,项目名称:jest,代码行数:26,代码来源:handle_deprecation_warnings.ts
示例5: handleObjectData
function handleObjectData(param, level: Level) {
//#region @backend
if (istartedInVscode()) {
consoleLog(param, level);
return;
}
let out = stringify(param, null, 4)
out = replace(out, /\".*"\:\ \"/g, /\"\: "/, chalk.green);
out = replace(out, /\".*"\:\ \{/g, /\"\: \{/, chalk.yellow);
out = replace(out, /\".*"\:\ \[/g, /\"\: \[/, chalk.red);
out = replace(out, /\".*"\:\ true/g, /\"\: true/, chalk.blue);
out = replace(out, /\".*"\:\ false/g, /\"\: false/, chalk.blue);
out = replace(out, /\".*"\:\ (\-|[0-9])/g, /\"\: (\-|[0-9])/, chalk.magenta);
out = out.replace(/\"/g, chalk.dim('"'))
.replace(/\{/g, chalk.dim('{'))
.replace(/\}/g, chalk.dim('}'))
.replace(/\}/g, chalk.dim('}'))
if (process.stdout.columns && process.stdout.columns > 0) {
out = out.split('\n').map(line => {
return (line.length < process.stdout.columns ?
line :
line.slice(0, process.stdout.columns - 6) + chalk.dim('...'));
}).join('\n');
}
consoleLog(out, level);
//#endregion
}
开发者ID:darekf77,项目名称:ng2-logger,代码行数:29,代码来源:backend-logging.ts
示例6:
const assertThrowingMatcherHint = (operatorName: string) =>
operatorName
? chalk.dim('assert') +
chalk.dim('.' + operatorName + '(') +
chalk.red('function') +
chalk.dim(')')
: '';
开发者ID:facebook,项目名称:jest,代码行数:7,代码来源:assertionErrorMessage.ts
示例7: createTreeStructure
function createTreeStructure(tree: IProjectsTree): ITree {
let name: string | undefined;
const children: ITreeChildren = [];
for (const [dir, project] of tree.entries()) {
// This is a leaf node (aka a project)
if (typeof project === 'string') {
name = chalk.green(project);
continue;
}
// If there's only one project and the key indicates it's a leaf node, we
// know that we're at a package folder that contains a package.json, so we
// "inline it" so we don't get unnecessary levels, i.e. we'll just see
// `foo` instead of `foo -> foo`.
if (project.size === 1 && project.has(projectKey)) {
const projectName = project.get(projectKey)! as string;
children.push({
children: [],
name: dirOrProjectName(dir, projectName),
});
continue;
}
const subtree = createTreeStructure(project);
// If the name is specified, we know there's a package at the "root" of the
// subtree itself.
if (subtree.name !== undefined) {
const projectName = subtree.name;
children.push({
children: subtree.children,
name: dirOrProjectName(dir, projectName),
});
continue;
}
// Special-case whenever we have one child, so we don't get unnecessary
// folders in the output. E.g. instead of `foo -> bar -> baz` we get
// `foo/bar/baz` instead.
if (subtree.children && subtree.children.length === 1) {
const child = subtree.children[0];
const newName = chalk.dim(path.join(dir.toString(), child.name!));
children.push({
children: child.children,
name: newName,
});
continue;
}
children.push({
children: subtree.children,
name: chalk.dim(dir.toString()),
});
}
return { name, children };
}
开发者ID:elastic,项目名称:kibana,代码行数:60,代码来源:projects_tree.ts
示例8: developers
export const usageRoot = (showQuickstart: boolean) => `
Serverless GraphQL backend for frontend developers (${chalk.underline('https://www.graph.cool')})
${chalk.dim('Usage:')} ${chalk.bold('graphcool')} [command]
${chalk.dim('Commands:')}${showQuickstart ? `
quickstart Open Graphcool Quickstart examples`: ''}
init Create a new project
push Push project file changes
pull Download the latest project file
export Export project data
endpoints Print GraphQL endpoints
console Open Graphcool Console
playground Open GraphQL Playground
projects List projects
delete Delete existing projects
auth Sign up or login
version Print version
Run 'graphcool COMMAND --help' for more information on a command.
${chalk.dim('Examples:')}
${chalk.gray('-')} Initialize a new Graphcool project
${chalk.cyan('$ graphcool init')}
${chalk.gray('-')} Local setup of an existing project
${chalk.cyan('$ graphcool pull -p <project-id | alias>')}
${chalk.gray('-')} Update live project with local changes
${chalk.cyan('$ graphcool push')}
`
开发者ID:sadeeqaji,项目名称:graphcool-cli,代码行数:33,代码来源:usage.ts
示例9: columnar
export function columnar(rows: string[][], { hsep = chalk.dim('-'), vsep = chalk.dim('|'), headers }: ColumnarOptions): string {
const includeHeaders = headers ? true : false;
if (!rows[0]) {
return '';
}
const columnCount = headers ? headers.length : rows[0].length;
const columns = headers ?
headers.map(header => [chalk.bold(header)]) :
rows[0].map(() => []);
for (const row of rows) {
let highestLineCount = 0;
const splitRows = row.map(cell => {
const lines = cell.split('\n');
highestLineCount = Math.max(highestLineCount, lines.length);
return lines;
});
for (const rowIndex in row) {
if (columns[rowIndex]) {
columns[rowIndex].push(...splitRows[rowIndex], ...Array(highestLineCount - splitRows[rowIndex].length).fill(''));
}
}
}
const paddedColumns = columns.map((col, columnIndex) => {
if (columnIndex < columnCount - 1) {
const spaceCol = generateFillSpaceStringList(col);
return col.map((cell, cellIndex) => `${cell}${spaceCol[cellIndex]}${vsep === '' ? '' : `${vsep} `}`);
} else {
return col;
}
});
let longestRowLength = 0;
const singleColumn = paddedColumns.reduce((a, b) => {
return a.map((_, i) => {
const r = a[i] + b[i];
longestRowLength = Math.max(longestRowLength, stringWidth(r));
return r;
});
});
if (includeHeaders && hsep !== '') {
singleColumn.splice(1, 0, hsep.repeat(longestRowLength));
}
return singleColumn.join('\n');
}
开发者ID:driftyco,项目名称:ionic-cli,代码行数:51,代码来源:format.ts
示例10: template
function template(error: string | undefined) {
if (error) {
error = `${chalk.red(chalk.bold('Error: ' + error))}`
}
const { version } = require('../../package.json')
return `
${chalk.dim('TextRunner ' + version)}
${error || ''}
USAGE: ${chalk.bold('text-run [<options>] <command>')}
COMMANDS
${chalk.bold(
'run'
)} [<filename>] runs all tests on the given file/folder or entire documentation
${chalk.bold(
'dynamic'
)} [<filename>] runs only the programmatic tests, skips checking links
${chalk.bold(
'static'
)} [<filename>] checks only the links, skips programmatic tests
${chalk.bold('setup')} creates an example configuration file
${chalk.bold('add')} <filename> scaffolds a new block type handler
${chalk.bold('unused')} <filename> shows unused custom activities
${chalk.bold('help')} shows this help screen
${chalk.bold('version')} shows the currently installed version
${chalk.bold('debug')} shows debug data
OPTIONS
${chalk.bold('--config')} provide a custom configuration filename
${chalk.bold('--offline')} don't check external links
`
}
开发者ID:Originate,项目名称:tutorial-runner,代码行数:35,代码来源:help.ts
注:本文中的chalk.dim函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论