paulp/sbt-extras — pull request #43 by gildegoma (2013-03-10 23:40:42+00:00)
Title: Link option files from SBT_OPTS and JVM_OPTS variables + Comments in option files

As discussed in https://github.com/paulp/sbt-extras/pull/36, I propose here these two additions:

* Refer to option file from SBT_OPTS and JVM_OPTS variable, with `@` prefix (e.g. `export SBT_OPTS="@/etc/sbtopts"`
* `#` comments are allowed in sbt and jvm option files

### Notes for the review

As already warned, I am not an experienced shell-script programmer and it is quite possible that I missed the correct way of doing things. I tried to make it as DRY as possible, keeping a balance with bash features and limitations. I'm looking forward to reading your review and still feel ready to improve/rewrite the code if necessary. Below some more details about proposed changes:

* in README.md, I propose to add a small section about the 'sbt-extras' requirements (bash 4+, sed,...?). The motivation came while I was trying to run it on a Mac OS X 10.7 box, which is still running by default with bash 3.2 (!). While writing, I wonder if it wouldn't be better to simply add a sanity check into the script, and refuse to run on older version of bash, etc. What do you think?
* I introduce a 'sed' dependency, which may lead to portability issues (see 47f4b01 for instance. BSD sed does not support `\s` regexp wildcard, while GNU sed does). I think it is reasonable to expect 'sed' presence... I confess that so far I did not investigate how (easy) a pure-bash could be implemented. What is your opinion?
* I added some 'vlog' to help figure out which source is used for sbt/jvm options
* **corner case:** In the current implementation, there is no error/warning if "@"-linked file does not exist, and a possible `.sbtopts` (respectively `.jvmopts`) will be used. The new 'vlog' message will at least make things clear to the user.
* Sorry, but I did not spend enough time to get very good wording for the script self-documentation (`-h` message). Formulation and english quality certainly need strong improvements... Thanks in advance for reviewing this part too!