Comparing version 0.0.6 to 0.1.0
@@ -134,2 +134,25 @@ require('any-promise/register/q'); | ||
program | ||
.command('http') | ||
.description( | ||
'Execute HTTPie commands with auto injected ASAP Auth Header. ' + | ||
'Prerequisite: HTTPie needs to be installed (https://github.com/jkbrzt/httpie)' | ||
) | ||
.allowUnknownOption() | ||
.action(logErrorsAndResolve(function () { | ||
return q() | ||
.then(function () { | ||
return asapConfig.getFromOptions(program); | ||
}) | ||
.then(asapConfig.validate) | ||
.then(jwtUtil.getJwtAuthHeader) | ||
.then(function (authHeader) { | ||
var httpArgs = _.takeRightWhile(process.argv, function (item) { | ||
return item !== 'http'; | ||
}); | ||
return ['http'].concat(httpArgs).concat(['Authorization:' + authHeader]); | ||
}) | ||
.then(executeCommand); | ||
})); | ||
program.parse(process.argv); | ||
@@ -140,2 +163,2 @@ | ||
} | ||
}; | ||
}; |
{ | ||
"name": "asap-cli", | ||
"version": "0.0.6", | ||
"version": "0.1.0", | ||
"description": "A command line utility for generating ASAP (JWT tokens as per the Atlassian Service Authentication Protocol) token and making curl calls with the same.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -30,2 +30,3 @@ # ASAP Cli | ||
curl Execute curl commands with auto injected ASAP Auth Header | ||
http Execute HTTPie commands with auto injected ASAP Auth Header. Prerequisite: HTTPie needs to be installed (https://github.com/jkbrzt/httpie) | ||
@@ -82,3 +83,5 @@ Options: | ||
Make curl calls with the ASAP token (generated from the config file) set as the Authorization header. All the arguments meant for the curl command are passed through to curl. So this will support all the options that curl supports. The config file or the values read from the config file can be overriden by specifying the global options. | ||
Make curl calls with the ASAP token (generated from the config file) set as the Authorization header. All the | ||
arguments meant for the curl command are passed through to curl. So this will support all the options that curl | ||
supports. The config file or the values read from the config file can be overriden by specifying the global options. | ||
@@ -100,3 +103,26 @@ **Examples** | ||
### http | ||
Make HTTPie calls with the ASAP token (generated from the config file) set as the Authorization header. All the | ||
arguments meant for the HTTPie command are passed through. So this will support all the options that HTTPie supports. | ||
The config file or the values read from the config file can be overriden by specifying the global options. | ||
Prerequisite: HTTPie needs to be installed. See https://github.com/jkbrzt/httpie for installation and usage. | ||
**Examples** | ||
``` | ||
$ asap http PUT https://authenticated-service.company.com/item X-API-Token:123 foo=bar | ||
HTTP/1.1 200 OK | ||
Connection: keep-alive | ||
Content-Length: 26 | ||
Content-Type: application/json; charset=utf-8 | ||
{ | ||
"data": "Some data" | ||
} | ||
``` | ||
## Development guide | ||
@@ -103,0 +129,0 @@ |
18752
225
154