white spaces in bash autocompletion

Hello dear community!

I've recently written a BASH function for auto completion of options. It works like following: if a user types a command and then an argument to this command which starts with "^-" and then presses TAB, then 'user_command --help (or -h)' is invoked and possible options are retrieved form the program's help and suggested as possible completions. Simplified it looks like:

completion_rules() {
	case "$2" in
		# if the word to be autocompleted
		# starts with "-", then look for options
		-*)
			COMPREPLY=( $( get_options_from_help "$1" | grep "^$2" ) );; # get_options_from_help is my function
	esac
}

autocomplete_options() {
   ...
   complete -o bashdefault -o default -F completion_rules "$@"
}

But I have a little problem, I want to make my function a little bit cuter. I want to add white spaces to the completed option if it doesn't end with "=" sign, and vice versa not to add white space if auto completed option ends with "=". It could be done by supplying '-o nospace' to 'complete'. But I don't want that this affects auto completions of other arguments (which don't start with '^-') for those arguments white spaces shall be added in the regular way.
Thanks in advance for your help. Write to me, if you didn't understand my problem. I'll try to describe it better