Enhance support for write commnet in plugins.txt
- add ability to write comment in plugins.txt - remove leading spaces/tabs - remove trailing spaces/tabs - protect against empty lines Enhanced #505 Signed-off-by: guessi <guessi@gmail.com>
This commit is contained in:
parent
ca17603a0f
commit
d85be653b5
|
@ -191,7 +191,13 @@ main() {
|
|||
# Read plugins from stdin or from the command line arguments
|
||||
if [[ ($# -eq 0) ]]; then
|
||||
while read -r line || [ "$line" != "" ]; do
|
||||
plugins+=("${line}")
|
||||
# Remove leading/trailing spaces, comments, and empty lines
|
||||
plugin=$(echo "${line}" | sed -e 's/^[ \t]*//g' -e 's/[ \t]*$//g' -e 's/[ \t]*#.*$//g' -e '/^[ \t]*$/d')
|
||||
|
||||
# Avoid adding empty plugin into array
|
||||
if [ ${#plugin} -ne 0 ]; then
|
||||
plugins+=("${plugin}")
|
||||
fi
|
||||
done
|
||||
else
|
||||
plugins=("$@")
|
||||
|
|
|
@ -1,5 +1,21 @@
|
|||
# comment line should be skipped
|
||||
|
||||
# simple case
|
||||
ant:1.3
|
||||
maven-plugin:2.7.1
|
||||
mesos:0.13.0
|
||||
git:latest
|
||||
filesystem_scm:experimental
|
||||
|
||||
# trailing spaces
|
||||
maven-plugin:2.7.1
|
||||
|
||||
# leading spaces
|
||||
mesos:0.13.0
|
||||
|
||||
# leading spaces, and trailing spaces
|
||||
git:latest
|
||||
|
||||
# with comments at the end
|
||||
filesystem_scm:experimental # comment at the end
|
||||
|
||||
# empty line
|
||||
|
||||
#
|
||||
# empty line
|
||||
|
|
Loading…
Reference in New Issue