Skip to content

Commit a6d64d8

Browse files
committed
sorting options + some cleanup
1 parent 9a6c3f2 commit a6d64d8

10 files changed

Lines changed: 28 additions & 25 deletions

File tree

src/targets/objc/nsurlsession.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ var CodeBuilder = require('../../helpers/code-builder')
1616

1717
module.exports = function (source, options) {
1818
var opts = util._extend({
19-
timeout: '10',
2019
indent: ' ',
21-
pretty: true
20+
pretty: true,
21+
timeout: '10'
2222
}, options)
2323

2424
var code = new CodeBuilder(opts.indent)

src/targets/php/curl.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@ var CodeBuilder = require('../../helpers/code-builder')
1515

1616
module.exports = function (source, options) {
1717
var opts = util._extend({
18+
closingTag: false,
1819
indent: ' ',
19-
noTags: false,
2020
maxRedirects: 10,
21-
timeout: 30,
2221
namedErrors: false,
23-
closingTag: false
22+
noTags: false,
23+
shortTags: false,
24+
timeout: 30
2425
}, options)
2526

2627
var code = new CodeBuilder(opts.indent)
2728

2829
if (!opts.noTags) {
29-
code.push('<?php')
30+
code.push(opts.shortTags ? '<?' : '<?php')
3031
.blank()
3132
}
3233

@@ -121,7 +122,7 @@ module.exports = function (source, options) {
121122
.push(1, 'echo $response;')
122123
.push('}')
123124

124-
if (opts.closingTag) {
125+
if (!opts.noTags && opts.closingTag) {
125126
code.blank()
126127
.push('?>')
127128
}
@@ -133,5 +134,5 @@ module.exports.info = {
133134
key: 'curl',
134135
title: 'cURL',
135136
link: 'http://php.net/manual/en/book.curl.php',
136-
description: 'PHP with libcurl'
137+
description: 'PHP with ext-curl'
137138
}

src/targets/php/http1.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ var CodeBuilder = require('../../helpers/code-builder')
1616

1717
module.exports = function (source, options) {
1818
var opts = util._extend({
19+
closingTag: false,
1920
indent: ' ',
2021
noTags: false,
21-
closingTag: false
22+
shortTags: false
2223
}, options)
2324

2425
var code = new CodeBuilder(opts.indent)
2526

2627
if (!opts.noTags) {
27-
code.push('<?php')
28+
code.push(opts.shortTags ? '<?' : '<?php')
2829
.blank()
2930
}
3031

@@ -80,7 +81,7 @@ module.exports = function (source, options) {
8081
.push(1, 'echo $ex;')
8182
.push('}')
8283

83-
if (opts.closingTag) {
84+
if (!opts.noTags && opts.closingTag) {
8485
code.blank()
8586
.push('?>')
8687
}

src/targets/php/http2.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,17 @@ var CodeBuilder = require('../../helpers/code-builder')
1616

1717
module.exports = function (source, options) {
1818
var opts = util._extend({
19+
closingTag: false,
1920
indent: ' ',
2021
noTags: false,
21-
closingTag: false
22+
shortTags: false
2223
}, options)
2324

2425
var code = new CodeBuilder(opts.indent)
2526
var hasBody = false
2627

2728
if (!opts.noTags) {
28-
code.push('<?php')
29+
code.push(opts.shortTags ? '<?' : '<?php')
2930
.blank()
3031
}
3132

@@ -112,7 +113,7 @@ module.exports = function (source, options) {
112113
.blank()
113114
.push('echo $response->getBody();')
114115

115-
if (opts.closingTag) {
116+
if (!opts.noTags && opts.closingTag) {
116117
code.blank()
117118
.push('?>')
118119
}

src/targets/shell/curl.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
'use strict'
1212

1313
var util = require('util')
14-
var helpers = require('./helpers')
14+
var helpers = require('../../helpers/shell')
1515
var CodeBuilder = require('../../helpers/code-builder')
1616

1717
module.exports = function (source, options) {
1818
var opts = util._extend({
19-
short: false,
20-
indent: ' '
19+
indent: ' ',
20+
short: false
2121
}, options)
2222

2323
var code = new CodeBuilder(opts.indent, opts.indent !== false ? ' \\\n' + opts.indent : ' ')
@@ -59,5 +59,5 @@ module.exports.info = {
5959
key: 'curl',
6060
title: 'cURL',
6161
link: 'http://curl.haxx.se/',
62-
description: 'curl is a command line tool and library for transferring data with URL syntax'
62+
description: 'cURL is a command line tool and library for transferring data with URL syntax'
6363
}

src/targets/shell/httpie.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111
'use strict'
1212

1313
var util = require('util')
14-
var helpers = require('./helpers')
14+
var helpers = require('../../helpers/shell')
1515
var CodeBuilder = require('../../helpers/code-builder')
1616

1717
module.exports = function (source, options) {
1818
var opts = util._extend({
19-
queryParams: false,
2019
body: false,
2120
cert: false,
2221
headers: false,
2322
indent: ' ',
2423
pretty: false,
2524
print: false,
25+
queryParams: false,
2626
short: false,
2727
style: false,
2828
timeout: false,

src/targets/shell/wget.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
'use strict'
1212

1313
var util = require('util')
14-
var helpers = require('./helpers')
14+
var helpers = require('../../helpers/shell')
1515
var CodeBuilder = require('../../helpers/code-builder')
1616

1717
module.exports = function (source, options) {

src/targets/swift/nsurlsession.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ var CodeBuilder = require('../../helpers/code-builder')
1616

1717
module.exports = function (source, options) {
1818
var opts = util._extend({
19-
timeout: '10',
2019
indent: ' ',
21-
pretty: true
20+
pretty: true,
21+
timeout: '10'
2222
}, options)
2323

2424
var code = new CodeBuilder(opts.indent)

test/fixtures/available-targets.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"key": "curl",
1010
"title": "cURL",
1111
"link": "http://curl.haxx.se/",
12-
"description": "curl is a command line tool and library for transferring data with URL syntax"
12+
"description": "cURL is a command line tool and library for transferring data with URL syntax"
1313
},
1414
{
1515
"key": "httpie",
@@ -95,7 +95,7 @@
9595
"key": "curl",
9696
"title": "cURL",
9797
"link": "http://php.net/manual/en/book.curl.php",
98-
"description": "PHP with libcurl"
98+
"description": "PHP with ext-curl"
9999
},
100100
{
101101
"key": "http1",

0 commit comments

Comments
 (0)