diff options
author | Paweł Zuzelski <pawelz@pld-linux.org> | 2010-03-29 15:19:26 +0200 |
---|---|---|
committer | Paweł Zuzelski <pawelz@pld-linux.org> | 2010-03-29 15:19:26 +0200 |
commit | bc681bb8b4fb4a9974a0f3f9d282038bdde77f28 (patch) | |
tree | 0d14881a31e2c8024e4858849f6e4ff18cb73946 /examples | |
parent | f4344aabd33e1f82093c25c22c224ca286112b41 (diff) |
Add modeline in 'new', strip comments in 'load'.
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/data/scripts/formfiller.sh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh index 0b0d7e0..97b046b 100755 --- a/examples/data/scripts/formfiller.sh +++ b/examples/data/scripts/formfiller.sh @@ -162,6 +162,9 @@ then option=`echo -e -n "$menu"| dmenu ${LINES} -nb "${NB}" -nf "${NF}" -sb "${SB}" -sf "${SF}" -p "${PROMPT}"` fi + # Remove comments + sed '/^>/d' -i $tmpfile + sed 's/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):\(off\|no\|false\|unchecked\|0\|$\)/\1{\2}(\3):0/I;s/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):[^0]\+/\1{\2}(\3):1/I' -i $keydir/$domain fields=`cat $keydir/$domain | \ sed -n "/^!profile=${option}/,/^!profile=/p" | \ @@ -189,6 +192,7 @@ then # Remove comments sed '/^>/d' -i $tmpfile + sed 's/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):\(off\|no\|false\|unchecked\|0\|$\)/\1{\2}(\3):0/I;s/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):[^0]\+/\1{\2}(\3):1/I' -i $tmpfile fields=`cat $tmpfile | \ sed 's/^\([^(]\+(\)\(radio\|checkbox\|text\|search\|textarea\|password\)):/%{>\1\2):<}%/' | \ @@ -205,12 +209,8 @@ then else if [ "$action" == 'new' -o "$action" == 'add' ] then - if [ "$action" == 'new' ] - then - echo "!profile=NAME_THIS_PROFILE$RANDOM" > $keydir/$domain - else - echo "!profile=NAME_THIS_PROFILE$RANDOM" >> $keydir/$domain - fi + [ "$action" == 'new' ] && echo "$MODELINE" > $keydir/$domain + echo "!profile=NAME_THIS_PROFILE$RANDOM" >> $keydir/$domain # # 2. and 3. line (tr -d and sed) are because, on gmail login for example, # <input > tag is splited into lines |