File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ At the heart of this module is the [HAR Request object](http://www.softwareishar
122122
123123### Output Targets
124124
125- output [ targets] ( /src/targets ) are simple modules that expose a constructor * (which handles the transformation)* and a utility method ` extname ` * (used in CLI for writing output into disk) *
125+ output [ targets] ( /src/targets ) are simple modules that expose a constructor * (which handles the transformation)* and a utility ` info ` method
126126
127127``` js
128128module .exports = function (opts ) {
@@ -133,8 +133,14 @@ module.exports = function (opts) {
133133 // return processed output as string
134134};
135135
136- module .exports .extname = function () {
137- // return preferred filename extention
136+ module .exports .info = function () {
137+ // return target info
138+ return {
139+ key: ' node' , // target key
140+ ext: ' .js' , // preferred extension
141+ title: ' ' , // target label
142+ description: ' ' // target description
143+ }
138144};
139145```
140146
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ async.waterfall([
8686
8787 var filename = path . format ( {
8888 dir : dir ,
89- base : name + HTTPSnippet . extname ( cmd . target )
89+ base : name + HTTPSnippet . info ( cmd . target ) . ext
9090 } ) ;
9191
9292 fs . writeFile ( filename , snippets [ index ] ) ;
Original file line number Diff line number Diff line change 11{
2- "version" : " 1.0.0-beta" ,
2+ "version" : " 1.0.0-beta.1 " ,
33 "name" : " httpsnippet" ,
44 "description" : " HTTP Request snippet generator for *most* languages" ,
55 "main" : " ./src/index.js" ,
Original file line number Diff line number Diff line change @@ -73,6 +73,6 @@ module.exports._targets = function () {
7373 return Object . keys ( targets ) ;
7474} ;
7575
76- module . exports . extname = function ( lang ) {
77- return targets [ lang ] . extname ( ) ;
76+ module . exports . info = function ( lang ) {
77+ return targets [ lang ] . info ( ) ;
7878} ;
Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ module.exports = function (options) {
4242 return code . join ( opts . indent !== false ? ' \\\n' + opts . indent : ' ' ) ;
4343} ;
4444
45- module . exports . extname = function ( ) {
46- return '.sh' ;
45+ module . exports . info = function ( ) {
46+ return {
47+ key : 'curl' ,
48+ ext : '.sh' ,
49+ title : 'cURL' ,
50+ link : 'http://curl.haxx.se/' ,
51+ description : 'curl is a command line tool and library for transferring data with URL syntax'
52+ } ;
4753} ;
Original file line number Diff line number Diff line change @@ -105,6 +105,12 @@ module.exports = function (options) {
105105 return code . join ( opts . indent !== false ? ' \\\n' + opts . indent : ' ' ) ;
106106} ;
107107
108- module . exports . extname = function ( ) {
109- return '.sh' ;
108+ module . exports . info = function ( ) {
109+ return {
110+ key : 'httpie' ,
111+ ext : '.sh' ,
112+ title : 'HTTPie' ,
113+ link : 'http://httpie.org/' ,
114+ description : 'a CLI, cURL-like tool for humans'
115+ } ;
110116} ;
Original file line number Diff line number Diff line change @@ -63,6 +63,12 @@ module.exports = function (options) {
6363 return code . join ( '\n' ) ;
6464} ;
6565
66- module . exports . extname = function ( ) {
67- return '.js' ;
66+ module . exports . info = function ( ) {
67+ return {
68+ key : 'node' ,
69+ ext : '.js' ,
70+ title : 'Node.JS' ,
71+ link : 'http://nodejs.org/api/http.html#http_http_request_options_callback' ,
72+ description : 'Node.js native HTTP interface'
73+ } ;
6874} ;
Original file line number Diff line number Diff line change @@ -102,6 +102,12 @@ module.exports = function (options) {
102102 return code . join ( '\n' ) ;
103103} ;
104104
105- module . exports . extname = function ( ) {
106- return '.php' ;
105+ module . exports . info = function ( ) {
106+ return {
107+ key : 'php' ,
108+ ext : '.php' ,
109+ title : 'PHP' ,
110+ link : 'http://php.net/manual/en/book.curl.php' ,
111+ description : 'PHP with libcurl'
112+ } ;
107113} ;
Original file line number Diff line number Diff line change @@ -45,6 +45,12 @@ module.exports = function (options) {
4545 return code . join ( opts . indent !== false ? ' \\\n' + opts . indent : ' ' ) ;
4646} ;
4747
48- module . exports . extname = function ( ) {
49- return '.sh' ;
48+ module . exports . info = function ( ) {
49+ return {
50+ key : 'wget' ,
51+ ext : '.sh' ,
52+ title : 'Wget' ,
53+ link : 'https://www.gnu.org/software/wget/' ,
54+ description : 'a free software package for retrieving files using HTTP, HTTPS'
55+ } ;
5056} ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments