\* sf /script framework/ * Example #+begin_src bash sfname="calc" sfdesc="A simple calculator which can add and subtract." sfargs+=("A;First number") sfargs+=("B;Second number") sfargs+=("substract;s;Substract B from A") sfargs+=("multiply;m;MULTIPLICATOR;1;Multiply the result with MULTIPLICATOR") sfexamples+=("calc 3 5;Prints the result of 3 + 5") sfexamples+=("calc -s 2 1;Prints the result of 2 - 1") sfexamples+=("calc -m 3 -s 2 1;Prints the result of (2 - 1) * 3") sfextrausage="No copyright at all." source sf res=0 if [ "$substract" == true ]; then res=`expr $A - $B` else res=`expr $A + $B` fi if [ "$multiply" -ge 1 ]; then res=`expr $res \* $multiply` fi echo "The result is $sftbf$res$sftrst." #+end_src Help output: #+begin_example Usage: calc OPTIONS A B A simple calculator which can add and subtract. POSITIONAL ARGUMENTS A First number B Second number OPTIONS -s, --substract Substract B from A -m, --multiply MULTIPLICATOR Multiply the result with MULTIPLICATOR (default: 1) EXAMPLES calc 3 5 Prints the result of 3 + 5 calc -s 2 1 Prints the result of 2 - 1 calc -m 3 -s 2 1 Prints the result of (2 - 1) * 3 No copyright at all. #+end_example Script output: #+begin_example The result is 8. #+end_example