本文整理汇总了TypeScript中chalk.underline类的典型用法代码示例。如果您正苦于以下问题:TypeScript underline类的具体用法?TypeScript underline怎么用?TypeScript underline使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了underline类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: async
// delete and restore firestore
// delete (TODO) and restore authentication users
// delete and restore storage files
export default async (
foldername: string,
{
firestore,
storage,
accounts,
}: { firestore?: boolean; storage?: boolean; accounts?: boolean }
): Promise<void> => {
if (
!(await prompt<{ confirmed: boolean }>([
{
type: 'confirm',
name: 'confirmed',
message: chalk.underline.bgMagenta(
'Are you sure you want to restore from a backup? This WILL delete all live data in your firebase project!'
),
initial: false,
},
])).confirmed
) {
return;
}
console.log(' - now restoring');
const restoreAll = !firestore && !storage && !accounts;
try {
const projectId = await getProjectId();
await initializeAndEnsureAuth(projectId);
if (firestore || restoreAll) {
console.log('restoring firestore');
console.log('delete firestore');
await deleteFirestore();
console.log('import firestore');
await importFirestore(
path.join(resolveApp(foldername), 'firestore.json')
);
}
if (accounts || restoreAll) {
console.log('restoring authentication users');
await deleteAuthenticationUsers();
await importAuthenticationUsers(
path.join(resolveApp(foldername), 'accounts.json')
);
}
if (storage || restoreAll) {
console.log('restoring storage');
await deleteStorage(projectId);
// upload all files from backup
await importStorage(
projectId,
path.join(resolveApp(foldername), 'storage')
);
}
} catch (error) {
console.log(error);
}
};
示例2: parseInt
server.listen(port, hostname, () => {
const address = server.address();
const actualPort = typeof address === 'string' ? port : address.port;
const self = cluster.isMaster
? isDev
? `server (pid=${process.pid})`
: 'server'
: `worker ${process.env.POSTGRAPHILE_WORKER_NUMBER} (pid=${process.pid})`;
const versionString = `v${manifest.version}`;
if (cluster.isMaster || process.env.POSTGRAPHILE_WORKER_NUMBER === '1') {
console.log('');
console.log(
`PostGraphile ${versionString} ${self} listening on port ${chalk.underline(
actualPort.toString(),
)} 🚀`,
);
console.log('');
const {
host: rawPgHost,
port: rawPgPort,
database: pgDatabase,
user: pgUser,
password: pgPassword,
} = pgConfig;
// Not using default because want to handle the empty string also.
const pgHost = rawPgHost || 'localhost';
const pgPort = (rawPgPort && parseInt(String(rawPgPort), 10)) || 5432;
const safeConnectionString = isDemo
? 'postgraphile_demo'
: `postgres://${pgUser ? pgUser : ''}${pgPassword ? ':[SECRET]' : ''}${
pgUser || pgPassword ? '@' : ''
}${pgUser || pgPassword || pgHost !== 'localhost' || pgPort !== 5432 ? pgHost : ''}${
pgPort !== 5432 ? `:${pgConfig.port || 5432}` : ''
}${pgDatabase ? `/${pgDatabase}` : ''}`;
const information: Array<string> = pluginHook(
'cli:greeting',
[
`GraphQL API: ${chalk.underline.bold.blue(
`http://${hostname}:${actualPort}${graphqlRoute}`,
)}` +
(postgraphileOptions.subscriptions
? ` (${postgraphileOptions.live ? 'live ' : ''}subscriptions enabled)`
: ''),
!disableGraphiql &&
`GraphiQL GUI/IDE: ${chalk.underline.bold.blue(
`http://${hostname}:${actualPort}${graphiqlRoute}`,
)}` +
(postgraphileOptions.enhanceGraphiql ||
postgraphileOptions.live ||
postgraphileOptions.subscriptions
? ''
: ` (enhance with '--enhance-graphiql')`),
`Postgres connection: ${chalk.underline.magenta(safeConnectionString)}${
postgraphileOptions.watchPg ? ' (watching)' : ''
}`,
`Postgres schema(s): ${schemas.map(schema => chalk.magenta(schema)).join(', ')}`,
`Documentation: ${chalk.underline(
`https://graphile.org/postgraphile/introduction/`,
)}`,
extractedPlugins.length === 0
? `Join ${chalk.bold(
sponsor,
)} in supporting PostGraphile development: ${chalk.underline.bold.blue(
`https://graphile.org/sponsor/`,
)}`
: null,
],
{
options: postgraphileOptions,
middleware,
port: actualPort,
chalk,
},
).filter(isString);
console.log(information.map(msg => ` ‣ ${msg}`).join('\n'));
console.log('');
console.log(chalk.gray('* * *'));
} else {
console.log(
`PostGraphile ${versionString} ${self} listening on port ${chalk.underline(
actualPort.toString(),
)} 🚀`,
);
}
console.log('');
});
示例3:
return failures.reduce((current, group) => {
const headline = chalk.underline.green(group.filename);
const formattedFailures = group.failures.map(formatFailure).join('\n');
return `${current}\n${headline}\n${formattedFailures}\n`;
}, '');
示例4: parseArgv
a: 'resource',
p: 'python',
f: 'flag',
c: 'configure',
m: 'make',
h: 'help',
l: 'loglevel',
'fake-argv': 'fakeArgv',
'gh-token': 'ghToken'
}
const argv = parseArgv(process.argv, { alias, default: { ...defaults, enableStdIn: true } })
const g = c.gray
let help = `
${c.bold('nexe <entry-file> [options]')}
${c.underline.bold('Options:')}
-i --input -- application entry point
-o --output -- path to output file
-t --target -- node version description
-n --name -- main app module name
-r --resource -- *embed files (glob) within the binary
--plugin -- extend nexe runtime behavior
${c.underline.bold('Building from source:')}
-b --build -- build from source
-p --python -- python2 (as python) executable path
-f --flag -- *v8 flags to include during compilation
-c --configure -- *arguments to the configure step
-m --make -- *arguments to the make/build step