Skip to content

Commit

Permalink
Added return_string arg to getargsorask.
Browse files Browse the repository at this point in the history
  • Loading branch information
natfarleydev committed Jun 14, 2017
1 parent 086e904 commit e49182e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions skybeard/decorators/getargsorask.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from ..utils import get_args


def getargsorask(vars_n_qs):
def getargsorask(vars_n_qs, return_string=False):
"""A combination of getargs and askfor decorator.
If the args are not provided during the function call, they will be asked
Expand All @@ -14,7 +14,13 @@ def getargsorask(vars_n_qs):
def _getargsorask_wrapper(f):
@wraps(f)
async def g(beard, msg):
args = get_args(msg)
args = get_args(msg, return_string)

# If return_string is enabled, the 'args' will be a single string.
# Convert this into a single item argument list.
if return_string:
args = [args]

kwargs = dict()
for (i, (var, question)) in enumerate(OrderedDict(vars_n_qs).items()):
try:
Expand Down

0 comments on commit e49182e

Please sign in to comment.