Skip to content

Commit

Permalink
Supported more types and permissions #6
Browse files Browse the repository at this point in the history
  • Loading branch information
icetee committed Jun 16, 2018
1 parent 006f30e commit d096e0c
Show file tree
Hide file tree
Showing 3 changed files with 270 additions and 16 deletions.
10 changes: 5 additions & 5 deletions lib/expressions.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const XRegExp = require('xregexp');

const REX_LISTUNIX = XRegExp(`
^(?<type>[\\-ld])
(?<permission>([\\-r][\\-w][\\-xstT]){3})
^(?<type>[bcdelfmpSs-])
(?<permission>((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-])))
(?<acl>(\\+))?\\s+
(?<inodes>\\d+)\\s+
(?<owner>\\d+|\\w+\\s+\\w+|\\w+|\\S+)\\s+
(?<group>\\d+|\\w+\\s+\\w+|\\w+|\\S+)\\s+
(?<size>\\d+)\\s+
(?<owner>\\d+|[A-Z]{1}\\w+\\s+[A-Z]{1}\\w+|\\w+|\\S+)\\s+
(?<group>\\d+|[A-Z]{1}\\w+\\s+[A-Z]{1}\\w+|\\w+|\\S+)\\s+
(?<size>\\d+(?:,\\s*\\d*)?)\\s+
(?<timestamp>((?<month1>\\w{3})\\s+
(?<date1>\\d{1,2})\\s+
(?<hour>\\d{1,2}):(?<minute>\\d{2}))|
Expand Down
3 changes: 2 additions & 1 deletion lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ class Parser extends EventEmitter {
acl: (retUnix.acl === '+'),
owner: retUnix.owner,
group: retUnix.group,
size: parseInt(retUnix.size, 10),
size: (retUnix.size && retUnix.size.indexOf(',') === -1) ? parseInt(retUnix.size, 10) : 0,
pointer: (retUnix.size && retUnix.size.indexOf(',') > -1) ? retUnix.size.replace(/\s+/g, '') : undefined,
date: undefined,
};

Expand Down
Loading

0 comments on commit d096e0c

Please sign in to comment.