erichs/composure

write function is broken

IsoLinearCHiP opened this issue · 0 comments

When I try to write a single function to a file I don't get sensible output.

$ echo "Hello World!"
Hello World!

$ draft hello
[master a23d548] Draft hello: Initial draft
 1 file changed, 1 insertion(+), 1 deletion(-)
Git Comment: 
On branch master
nothing to commit, working directory clean

$ write hello
#!/usr/bin/env bash
for f in about author example group param version
do
  eval "$f() { :; }"
done
unset f
main() {
  echo "edit me to do something useful!"
  exit 0
}

main $*

$ typeset -f hello
hello () 
{ 
    author 'IsoLinearCHiP';
    about '';
    param '';
    example '';
    group '';
    echo "Hello World!"
}

I think the problem is caused by b875c76 . The change in line 497. As far as I can tell, that line is trying to typeset -f "cite hello", which obviously does not work as there is no function cite hello with a space in it.

The previous version was not doing any harm, though I think the quotes are superfluous anyway, since spaces are not allowed in function names to my knowledge.

Changing that line back to the previous version fixes the error for me.