Comparing version 1.6.0 to 1.7.0
@@ -16,3 +16,2 @@ 'use strict'; | ||
require('./commands/run'); | ||
require('./commands/completion'); | ||
@@ -19,0 +18,0 @@ cli.command('projects', 'Project management'); |
@@ -14,27 +14,30 @@ 'use strict'; | ||
.action(function(projectName, path){ | ||
var url = Config.getProjectEndpoint(projectName); | ||
path = path.indexOf('?') === -1 ? (path + '?') : path; | ||
path = path[0] === '/' ? path : ('/' + path); | ||
url += path + '&trace&_token=' + encodeURIComponent(Config.getProjectToken(projectName)); | ||
request({ | ||
uri: url, | ||
method: 'POST' | ||
}, function(error, response, body){ | ||
if(error) { | ||
console.error(error); | ||
return; | ||
} | ||
console.log(body); | ||
var traceFile = response.headers['x-28msec-trace']; | ||
setTimeout(function(){ | ||
request({ | ||
uri: traceFile, | ||
method: 'GET' | ||
}, function(error, response, body){ | ||
if(body) { | ||
console.log(body.green); | ||
} | ||
}); | ||
}, 1000); | ||
projectName = projectName || Config.getDefaultProject(); | ||
return Config.refreshTokens(projectName).then(function(){ | ||
var url = Config.getProjectEndpoint(projectName); | ||
path = path.indexOf('?') === -1 ? (path + '?') : path; | ||
path = path[0] === '/' ? path : ('/' + path); | ||
url += path + '&trace&_token=' + encodeURIComponent(Config.getProjectToken(projectName)); | ||
request({ | ||
uri: url, | ||
method: 'POST' | ||
}, function(error, response, body){ | ||
if(error) { | ||
console.error(error); | ||
return; | ||
} | ||
console.log(body); | ||
var traceFile = response.headers['x-28msec-trace']; | ||
setTimeout(function(){ | ||
request({ | ||
uri: traceFile, | ||
method: 'GET' | ||
}, function(error, response, body){ | ||
if(body) { | ||
console.log(body.green); | ||
} | ||
}); | ||
}, 1000); | ||
}); | ||
}); | ||
}); |
@@ -23,3 +23,4 @@ 'use strict'; | ||
cmd.action(function(projectName){ | ||
Config.refreshTokens().then(function(){ | ||
projectName = projectName || Config.getDefaultProject(); | ||
Config.refreshTokens(projectName).then(function(){ | ||
var projectToken; | ||
@@ -26,0 +27,0 @@ try { |
@@ -13,3 +13,4 @@ 'use strict'; | ||
.action(function(projectName){ | ||
Config.refreshTokens().then(function(){ | ||
projectName = projectName || Config.getDefaultProject(); | ||
Config.refreshTokens(projectName).then(function(){ | ||
var projectToken; | ||
@@ -16,0 +17,0 @@ try { |
@@ -18,3 +18,4 @@ 'use strict'; | ||
.action(function(projectName){ | ||
return Config.refreshTokens().then(function(){ | ||
projectName = projectName || Config.getDefaultProject(); | ||
return Config.refreshTokens(projectName).then(function(){ | ||
var projectToken; | ||
@@ -21,0 +22,0 @@ try { |
@@ -176,4 +176,3 @@ 'use strict'; | ||
Config.prototype.refreshTokens = function () { | ||
console.log('Refreshing Tokens...'.grey); | ||
Config.prototype.refreshTokens = function (projectName) { | ||
var $28 = this.getAPIClient(); | ||
@@ -183,7 +182,7 @@ var that = this; | ||
var now = new Date().getTime(); | ||
if(now + 60 * 60 < exp) { | ||
console.log('API Tokens refreshed.'.grey); | ||
if(now + 60 * 60 < exp && projectName && this.config.project_tokens['project_'+projectName]) { | ||
return new Q(); | ||
} | ||
return $28.refreshTokens(this.getEmail(), this.getRefreshToken()).then(function (response) { | ||
console.log('Refreshing Tokens...'.grey); | ||
var session = response.body; | ||
@@ -190,0 +189,0 @@ that.save(session); |
@@ -9,3 +9,3 @@ { | ||
"description": "Command line utility to download and upload 28.io queries.", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"keywords": [ | ||
@@ -12,0 +12,0 @@ "jsoniq", |
@@ -118,18 +118,2 @@ #28.io CLI | ||
### Configure auto-complete | ||
Auto-complete is supported for Mac and Linux. | ||
To enable it in zsh, run: | ||
```bash | ||
echo '. <(28 --completion)' >> .zshrc | ||
``` | ||
To enable it in bash, run: | ||
```bash | ||
28 --completion >> ~/28.completion.sh | ||
echo 'source ~/28.completion.sh' >> .bash_profile | ||
``` | ||
## Settings | ||
@@ -161,4 +145,18 @@ | ||
## ChangeLog | ||
### Configure auto-complete | ||
Auto-complete is supported for Mac and Linux. | ||
To enable it in zsh, run: | ||
```bash | ||
echo '. <(28 --completion)' >> .zshrc | ||
``` | ||
To enable it in bash, run: | ||
```bash | ||
28 --completion >> ~/28.completion.sh | ||
echo 'source ~/28.completion.sh' >> .bash_profile | ||
``` | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
174010
1132
31
161