How to put a line comment for a multi-line command
This is how I do it. Essentially by using Bash's backtick command substitution one can place these comments anywhere along a long command line even if it is split across lines. I have put the echo command in front of your example so that you can execute the example and see how it works:
echo CommandName InputFiles `#1st comment` \
--option1 arg1 `#2nd comment` \
--option2 arg2 `#3rd comment`
Another example where you can put multiple comments at different points on one line:
some_cmd --opt1 `#1st comment` --opt2 `#2nd comment` --opt3 `#3rd comment`
You could store the arguments in an array:
args=(InputFiles # This is the comment for the 1st line
# You can have whole lines of comments in between, useful for:
#--deprecated-option # This isn't use any more
--option1 arg1 # This is the comment for the 2nd line
# And even blank lines in between for readability
--option2 arg2 # This is the comment for the 3nd line
)
CommandName "${args[@]}"
However I think this looks a bit hackish if it is only for the purpose of allowing comments for each argument. Therefore I'd just rewrite the comment so that it refers the the individual arguments, and put it above the whole command.