diff --git a/bin/beau b/bin/beau index 1f50117..ac8b4d6 100755 --- a/bin/beau +++ b/bin/beau @@ -56,8 +56,14 @@ if ( } if (program.cleanList) { - beau.requests.list.forEach(({ VERB, ALIAS, ENDPOINT }) => { - console.log(`${VERB}\t${ALIAS}\t${ENDPOINT}`); + beau.requests.list.forEach(({ VERB, ALIAS, ENDPOINT, DOCUMENTATION }) => { + if (typeof DOCUMENTATION !== 'undefined') { + let {title, description} = DOCUMENTATION; + console.log(`${VERB}\t${ALIAS}\t${ENDPOINT}\t${title}\t${description}`); + + } else { + console.log(`${VERB}\t${ALIAS}\t${ENDPOINT}`); + } }); } diff --git a/examples/jsonplaceholder.yml b/examples/jsonplaceholder.yml index 3e851ce..130bb8b 100644 --- a/examples/jsonplaceholder.yml +++ b/examples/jsonplaceholder.yml @@ -3,11 +3,18 @@ host: 'http://jsonplaceholder.typicode.com' GET /posts/: alias: posts + documentation: + title: Fetch Posts + description: Fetches all posts available. POST /posts/: alias: new-post + documentation: + title: New Post GET /users/$posts.body.0.userId: alias: post-user + documentation: + description: Fetches the user for a give post. params: hello: 'world' diff --git a/request.js b/request.js index 0f7e0d1..f976b5a 100644 --- a/request.js +++ b/request.js @@ -10,7 +10,7 @@ class Request { Object.keys(req).forEach(k => config[k.toUpperCase()] = req[k]); - let { REQUEST, ALIAS, PAYLOAD, HOST, PARAMS, HEADERS } = config; + let { REQUEST, ALIAS, PAYLOAD, HOST, PARAMS, HEADERS, DOCUMENTATION } = config; let { verb, endpoint } = this.parseRequest(REQUEST); this.VERB = verb; @@ -23,6 +23,8 @@ class Request { this.ALIAS = ALIAS; this.DEPENDENCIES = this.findDependencies(req); + this.DOCUMENTATION = DOCUMENTATION; + this.list = list; }