我想编辑gitolite3的配置文件,该文件是用perl编写的,看起来像这样:
# comments
# comments
%RC = (
# ------------------------------------------------------------------
# comments
UMASK => 0077,
# comments
GIT_CONFIG_KEYS => '',
# comments
ROLES => {
READERS => 1,
WRITERS => 1,
},
# comments
ENABLE => [
# comments
'help',
'desc',
'info',
'perms',
'writable',
# comments
],
);
# ------------------------------------------------------------------------------
# comments
1;
# comments
如果没有augeas可用,我需要保留评论的东西 - 它们对我和未来的管理员来说非常方便。
答案 0 :(得分:2)
由于gitolite.rc直接是一个关联数组,您可以考虑在perl中编写实用程序。
src/lib/Gitolite/Rc.pm
已经向您展示了如何加载该文件,provides a way to query the keys/values:
Usage: gitolite query-rc -a
gitolite query-rc [-n] [-q] rc-variable
-a print all variables and values (first level only)
-n do not append a newline if variable is scalar
-q exit code only (shell truth; 0 is success)
但您可以通过添加键/值的方式扩展这些功能并重新编写配置。