Skip to content

Commit

Permalink
Merge pull request #129 from appcelerator/timob-16853_3_2_X
Browse files Browse the repository at this point in the history
[TIMOB-16853] (3_2_X) Fixed disabling colors for 'setup' command.
  • Loading branch information
skypanther committed Apr 18, 2014
2 parents 294e59b + 22061ee commit f222a0e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* When installing a Titanium SDK using the CI version name, but omitting the branch, it now automatically scans all branches [TIMOB-15899]
* Fixed 'sdk' command to display custom Titanium SDK paths in SDK Install Locations [TIMOB-16141]
* Fixed bug where the password was not being discarded after logging in and ends up confusing the Android build [TIMOB-16422]
* Fixed disabling of colors for 'setup' command. Also fixed --no-color flag [TIMOB-16853]

3.2.2
-------------------
Expand Down
6 changes: 2 additions & 4 deletions lib/commands/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ exports.extendedDesc = __f('commands/setup');
* @returns {Object} Setup command configuration
*/
exports.config = function (logger, config, cli) {
fields.setup({ colors: cli.argv.colors });

return {
noAuth: true,
args: [
Expand All @@ -68,10 +70,6 @@ exports.config = function (logger, config, cli) {
exports.run = function (logger, config, cli, finished) {
logger.log(__('Enter %s at any time to quit.', 'ctrl-c'.cyan));

fields.setup({
colors: !!config.get('cli.colors')
});

var screens = new SetupScreens(logger, config, cli);

var queue = async.queue(function (screen, callback) {
Expand Down
13 changes: 10 additions & 3 deletions lib/titanium.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,20 @@ function run(locale) {
},
'colors': {
callback: function (value) {
var c = value !== false;
var c = process.stdout.isTTY ? value !== false : false;
colors.mode = c ? 'console' : 'none';
Object.keys(logger.transports).forEach(function (name) {
logger.transports[name].colorize = c;
});
if (!value) {
// since this function is called whenever --no-color or --no-colors is set
// and we don't know which one it was, we set whichever is not set and the
// parser will correctly set --no-colors
cli.argv.$_.indexOf('--no-color') == -1 && cli.argv.$_.push('--no-color');
cli.argv.$_.indexOf('--no-colors') == -1 && cli.argv.$_.push('--no-colors');
}
},
default: config.get('cli.colors', true),
default: process.stdout.isTTY ? config.get('cli.colors', true) : false,
desc: __('disable colors'),
hideDefault: true,
negate: true
Expand All @@ -235,7 +242,7 @@ function run(locale) {
negate: true
},
'progress-bars': {
default: config.get('cli.progressBars', true),
default: process.stdout.isTTY ? config.get('cli.progressBars', true) : false,
desc: __('disable progress bars'),
hideDefault: true,
negate: true
Expand Down

0 comments on commit f222a0e

Please sign in to comment.