diff options
Diffstat (limited to 'acf/persistence/backends/augeas.lua')
-rw-r--r-- | acf/persistence/backends/augeas.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/acf/persistence/backends/augeas.lua b/acf/persistence/backends/augeas.lua index ec13531..4cf623a 100644 --- a/acf/persistence/backends/augeas.lua +++ b/acf/persistence/backends/augeas.lua @@ -13,7 +13,7 @@ local copy = util.copy local function aug_path(path) return pth.join('/files', unpack(path)) end local function strip_name(name) - return type(name) == 'string' and string.match(name, '^[^][/=)%s]+') or name + return type(name) == 'string' and name:match('^[^][/=)%s]+') or name end local function ipath(path, index) return path..'['..index..']' end @@ -26,7 +26,11 @@ function backend:init() self.aug = require('augeas').init() end function backend:find(path, leaf) util.map( function(comp) - assert(comp == strip_name(comp) and not string.match(comp, '^%.+$')) + assert( + comp == strip_name(comp) and ( + type(comp) == 'number' or not comp:match('^%.+$') + ) + ) end, path ) @@ -107,7 +111,7 @@ function backend:set(mods) local ord = order(pth.join('/', unpack(path))) for _, sibling in ipairs(self.aug:match(pth.parent(mpath)..'/*')) do - if order(string.sub(strip_name(sibling), 7, -1)) > ord then + if order(strip_name(sibling):sub(7, -1)) > ord then self.aug:insert(sibling, pth.name(mpath), true) break end |