Files: 1441fdeb23ee6ecb5c47ac1013bcecd533a96d62 / directory.js
478 bytesRaw
1 | var h = require('hyperscript') |
2 | var fs = require('fs') |
3 | |
4 | exports.gives = 'command' |
5 | |
6 | exports.create = function (api) { |
7 | return function (cmd) { |
8 | if(!(cmd[0] == '.' || cmd[0] == '/')) return null |
9 | |
10 | return function (cb) { |
11 | var list = h('div', h('label', cmd)) |
12 | fs.readdir(cmd, function (err, ls) { |
13 | if(err) return cb() |
14 | else list.appendChild(h('ol', ls.map(function (file) { return h('li', file) }))) |
15 | cb(null, list) |
16 | }) |
17 | } |
18 | } |
19 | } |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
27 |
Built with git-ssb-web