diff --git a/bin/cqlsh.py b/bin/cqlsh.py index 46210dad10..56b709f9a4 100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@ -2554,9 +2554,10 @@ class SwitchCommand(object): print 'Disabled %s.' % (self.description,) return False + class SwitchCommandWithValue(SwitchCommand): """The same as SwitchCommand except it also accepts a value in place of ON. - + This returns a tuple of the form: (SWITCH_VALUE, PASSED_VALUE) eg: PAGING 50 returns (True, 50) PAGING OFF returns (False, None) @@ -2567,7 +2568,7 @@ class SwitchCommandWithValue(SwitchCommand): def __init__(self, command, desc, value_type=int): SwitchCommand.__init__(self, command, desc) self.value_type = value_type - + def execute(self, state, parsed, printerr): binary_switch_value = SwitchCommand.execute(self, state, parsed, printerr) switch = parsed.get_binding('switch') @@ -2578,6 +2579,7 @@ class SwitchCommandWithValue(SwitchCommand): value = None return (binary_switch_value, value) + def option_with_default(cparser_getter, section, option, default=None): try: return cparser_getter(section, option)