Skip to content

Commit

Permalink
Added --treeless flag for disabling directory listings (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
javilobo8 authored and leo committed Sep 14, 2017
1 parent b5637aa commit 8c1eec9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
19 changes: 17 additions & 2 deletions lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ exports.options = [
name: 'open',
description: 'Open local address in browser',
defaultValue: false
},
{
name: 'treeless',
description: `Don't display statics tree`,
defaultValue: false
}
]

Expand All @@ -56,7 +61,17 @@ exports.minimist = {
s: 'single',
u: 'unzipped',
n: 'clipless',
o: 'open'
o: 'open',
t: 'treeless'
},
boolean: ['auth', 'cors', 'silent', 'single', 'unzipped', 'clipless', 'open']
boolean: [
'auth',
'cors',
'silent',
'single',
'unzipped',
'clipless',
'open',
'treeless'
]
}
3 changes: 2 additions & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ module.exports = coroutine(function*(req, res, flags, current, ignoredFiles) {
)

// If it works, send the directory listing to the user
if (renderedDir) {
// If is treeless, stepover
if (renderedDir && !flags.treeless) {
return micro.send(res, 200, renderedDir)
}

Expand Down

0 comments on commit 8c1eec9

Please sign in to comment.