Commit: 1db4fc8978c66c2884c9056e78a4bfe08b67df47
Parent: 4f9dab9d0d33ae4f83f096625a5cc5528f75b903
Author: Randy Palamar
Date: Tue, 2 Jan 2024 10:25:24 -0700
replace tail component of src with srcsection in man()
This is useful when man() is called with the optional 'section'
parameter and can be used to replace components such as '.nro'
with a '.(section)'.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ninja.lua b/ninja.lua
@@ -489,9 +489,9 @@ function man(srcs, section)
if not src:match('^[$/]') then
src = '$srcdir/'..src
end
- local i = src:find('/', 1, true)
local srcsection = section or src:match('[^.]*$')
- file('share/man/man'..srcsection..'/'..src:match('[^/]*$'), '644', src)
+ local outsrc = src:gsub('[^.]*$', srcsection)
+ file('share/man/man'..srcsection..'/'..outsrc:match('[^/]*$'), '644', src)
end
end