swerc

anselm's simpler werc fork
git clone git://git.suckless.org/swerc
Log | Files | Refs | README

commit 684de181bde82ddea831decffa0656d1d7179757
parent cd5317749783380ac5120d04f506ae0da7341591
Author: uriel@soma <unknown>
Date:   Sun,  8 Feb 2009 00:22:46 +0000

Add conf_enable_app to add items to $enabled_apps, used from conf_enable_xxx functions so one doesn't need to both add stuff to $eanbled_apps and then call conf_enable_xxx, and to avoid enabling the same app twice.

New conf_enable_wiki function to follow the interface of other apps.
Diffstat:
Mapps/blagh/app.rc | 1+
Mapps/bridge/app.rc | 1+
Mapps/dirdir/app.rc | 9++++++++-
Mbin/wercconf.rc | 7+++++++
4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/apps/blagh/app.rc b/apps/blagh/app.rc @@ -3,6 +3,7 @@ fn conf_enable_blog { blagh_dirs=$* if(~ $#blagh_dirs 0) blagh_dirs=( . ) + conf_enable_app blagh } fn blagh_init { diff --git a/apps/bridge/app.rc b/apps/bridge/app.rc @@ -7,6 +7,7 @@ fn conf_enable_comments { } enable_comments=yes groups_allowed_comments=$* + conf_enable_app bridge } fn bridge_init { diff --git a/apps/dirdir/app.rc b/apps/dirdir/app.rc @@ -1,5 +1,12 @@ +fn conf_enable_wiki { + enable_wiki=yes + wiki_editors_group=$* + conf_enable_app dirdir +} + + fn dirdir_init { - if(! ~ $#enable_wiki 0 && check_user $wiki_editors_group admin) { + if(! ~ $#enable_wiki 0 && check_user $wiki_editors_group) { if(test -f $local_path.md) ll_add handlers_bar_left dirdir_controls diff --git a/bin/wercconf.rc b/bin/wercconf.rc @@ -10,3 +10,10 @@ fn conf_hide_paths { for(i in $*) dirfilter=$dirfilter^'/'^`{echo $i|sed 's!/!\\/!g'}^'/d; ' } + +# Usually will be called from within conf_enable_foo +fn conf_enable_app { + # Note: maybe we should add test -d apps/$1/? + if(! ~ $1 $enabled_apps) + enabled_apps=( $enabled_apps $1 ) +}