joyent/node-triton#183 triton profile create
should not use ANSI code styling if stdout isn't a TTY
Reviewed by: Orlando Vazquez <orlando@joyent.com> Approved by: Orlando Vazquez <orlando@joyent.com>
This commit is contained in:
parent
b66939751d
commit
d14ac041f4
@ -7,6 +7,9 @@ Known issues:
|
||||
|
||||
## not yet released
|
||||
|
||||
- [joyent/node-triton#183] `triton profile create` will no longer use ANSI
|
||||
codes for styling if stdout isn't a TTY.
|
||||
|
||||
## 5.1.0
|
||||
|
||||
- [joyent/node-triton#182] Add `-y, --yes` options to `triton profile create`
|
||||
|
@ -851,6 +851,18 @@ function ansiStylize(str, color) {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Style the given string with ANSI style codes *if stdout is a TTY*.
|
||||
*/
|
||||
function ansiStylizeTty(str, color) {
|
||||
if (!process.stdout.isTTY) {
|
||||
return str;
|
||||
} else {
|
||||
return ansiStylize(str, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function indent(s, indentation) {
|
||||
if (!indentation) {
|
||||
indentation = ' ';
|
||||
@ -1096,6 +1108,7 @@ module.exports = {
|
||||
cliSetupTritonApi: cliSetupTritonApi,
|
||||
editInEditor: editInEditor,
|
||||
ansiStylize: ansiStylize,
|
||||
ansiStylizeTty: ansiStylizeTty,
|
||||
indent: indent,
|
||||
chomp: chomp,
|
||||
generatePassword: generatePassword,
|
||||
|
@ -357,7 +357,7 @@ function _createProfile(opts, cb) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(common.ansiStylize('\n\n# Docker setup\n', 'bold'));
|
||||
console.log(common.ansiStylizeTty('\n\n# Docker setup\n', 'bold'));
|
||||
console.log(wrap80('This section will setup authentication to ' +
|
||||
'Triton DataCenter\'s Docker endpoint using your account ' +
|
||||
'and key information specified above. This is only required ' +
|
||||
|
Reference in New Issue
Block a user