Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

admin: .set command now handles spaces properly #1385

Merged
merged 1 commit into from
Dec 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions sopel/modules/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,13 @@ def set_config(bot, trigger):
bot.say('[{}] section has no option {}.'.format(section_name, option))
return

delim = trigger.group(2).find(' ')
# Skip preceeding whitespaces, if any.
while delim > 0 and delim < len(trigger.group(2)) and trigger.group(2)[delim] == ' ':
delim = delim + 1

# Display current value if no value is given.
value = trigger.group(4)
if not value:
if delim == -1 or delim == len(trigger.group(2)):
if not static_sec and bot.config.parser.has_option(section, option):
bot.reply("Option %s.%s does not exist." % (section_name, option))
return
Expand All @@ -207,6 +211,7 @@ def set_config(bot, trigger):
return

# Otherwise, set the value to one given as argument 2.
value = trigger.group(2)[delim:]
if static_sec:
descriptor = getattr(section.__class__, option)
try:
Expand Down