diff options
-rw-r--r-- | alot/commands/envelope.py | 6 | ||||
-rw-r--r-- | alot/commands/globals.py | 12 | ||||
-rw-r--r-- | alot/commands/thread.py | 10 | ||||
-rw-r--r-- | alot/completion.py | 6 | ||||
-rw-r--r-- | alot/utils/argparse.py (renamed from alot/utils/booleanaction.py) | 19 | ||||
-rwxr-xr-x | docs/source/generate_commands.py | 2 |
6 files changed, 35 insertions, 20 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index 5082cc8f..d0dce4be 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -26,7 +26,7 @@ from ..errors import GPGProblem from ..helper import email_as_string from ..helper import string_decode from ..settings import settings -from ..utils.booleanaction import BooleanAction +from ..utils import argparse as cargparse MODE = 'envelope' @@ -283,9 +283,9 @@ class SendCommand(Command): @registerCommand(MODE, 'edit', arguments=[ - (['--spawn'], {'action': BooleanAction, 'default': None, + (['--spawn'], {'action': cargparse.BooleanAction, 'default': None, 'help': 'spawn editor in new terminal'}), - (['--refocus'], {'action': BooleanAction, 'default': True, + (['--refocus'], {'action': cargparse.BooleanAction, 'default': True, 'help': 'refocus envelope after editing'})]) class EditCommand(Command): """edit mail""" diff --git a/alot/commands/globals.py b/alot/commands/globals.py index d05bdfcc..3e9c4461 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -33,7 +33,7 @@ from ..widgets.utils import DialogBox from ..db.errors import DatabaseLockedError from ..db.envelope import Envelope from ..settings import settings -from ..utils.booleanaction import BooleanAction +from ..utils import argparse as cargparse MODE = 'global' @@ -172,11 +172,11 @@ class RefreshCommand(Command): @registerCommand( MODE, 'shellescape', arguments=[ - (['--spawn'], {'action': BooleanAction, 'default': None, + (['--spawn'], {'action': cargparse.BooleanAction, 'default': None, 'help': 'run in terminal window'}), - (['--thread'], {'action': BooleanAction, 'default': None, + (['--thread'], {'action': cargparse.BooleanAction, 'default': None, 'help': 'run in separate thread'}), - (['--refocus'], {'action': BooleanAction, + (['--refocus'], {'action': cargparse.BooleanAction, 'help': 'refocus current buffer after command ' 'has finished'}), (['cmd'], {'help': 'command line to execute'})], @@ -403,7 +403,7 @@ class CallCommand(Command): @registerCommand(MODE, 'bclose', arguments=[ (['--redraw'], - {'action': BooleanAction, + {'action': cargparse.BooleanAction, 'help': 'redraw current buffer after command has finished'}), (['--force'], {'action': 'store_true', 'help': 'never ask for confirmation'})]) @@ -685,7 +685,7 @@ class HelpCommand(Command): (['--attach'], {'nargs': '+', 'help': 'attach files'}), (['--omit_signature'], {'action': 'store_true', 'help': 'do not add signature'}), - (['--spawn'], {'action': BooleanAction, 'default': None, + (['--spawn'], {'action': cargparse.BooleanAction, 'default': None, 'help': 'spawn editor in new terminal'}), (['rest'], {'nargs': '*'}), ]) diff --git a/alot/commands/thread.py b/alot/commands/thread.py index 6dd4f248..1e1e704e 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -35,7 +35,7 @@ from ..settings import settings from ..helper import parse_mailcap_nametemplate from ..helper import split_commandstring from ..helper import email_as_string -from ..utils.booleanaction import BooleanAction +from ..utils import argparse as cargparse from ..widgets.globals import AttachmentWidget MODE = 'thread' @@ -108,9 +108,9 @@ def determine_sender(mail, action='reply'): @registerCommand(MODE, 'reply', arguments=[ (['--all'], {'action': 'store_true', 'help': 'reply to all'}), - (['--list'], {'action': BooleanAction, 'default': None, + (['--list'], {'action': cargparse.BooleanAction, 'default': None, 'dest': 'listreply', 'help': 'reply to list'}), - (['--spawn'], {'action': BooleanAction, 'default': None, + (['--spawn'], {'action': cargparse.BooleanAction, 'default': None, 'help': 'open editor in new window'})]) class ReplyCommand(Command): @@ -313,7 +313,7 @@ class ReplyCommand(Command): @registerCommand(MODE, 'forward', arguments=[ (['--attach'], {'action': 'store_true', 'help': 'attach original mail'}), - (['--spawn'], {'action': BooleanAction, 'default': None, + (['--spawn'], {'action': cargparse.BooleanAction, 'default': None, 'help': 'open editor in new window'})]) class ForwardCommand(Command): @@ -465,7 +465,7 @@ class BounceMailCommand(Command): @registerCommand(MODE, 'editnew', arguments=[ - (['--spawn'], {'action': BooleanAction, 'default': None, + (['--spawn'], {'action': cargparse.BooleanAction, 'default': None, 'help': 'open editor in new window'})]) class EditNewCommand(Command): diff --git a/alot/completion.py b/alot/completion.py index 8ef0e507..f14f1888 100644 --- a/alot/completion.py +++ b/alot/completion.py @@ -14,7 +14,7 @@ from . import crypto from . import commands from .buffers import EnvelopeBuffer from .settings import settings -from .utils.booleanaction import BooleanAction +from .utils import argparse as cargparse from .helper import split_commandline from .addressbook import AddressbookError from .errors import CompletionError @@ -265,8 +265,8 @@ class ArgparseOptionCompleter(Completer): for optionstring in act.option_strings: if optionstring.startswith(pref): # append '=' for options that await a string value - if isinstance( - act, (argparse._StoreAction, BooleanAction)): + if isinstance(act, (argparse._StoreAction, + cargparse.BooleanAction)): optionstring += '=' res.append(optionstring) diff --git a/alot/utils/booleanaction.py b/alot/utils/argparse.py index 4c9ce1ed..968e9097 100644 --- a/alot/utils/booleanaction.py +++ b/alot/utils/argparse.py @@ -1,6 +1,21 @@ +# encoding=utf-8 # Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com> -# This file is released under the GNU GPL, version 3 or a later revision. -# For further details see the COPYING file + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Custom extensions of the argparse module.""" + from __future__ import absolute_import import argparse diff --git a/docs/source/generate_commands.py b/docs/source/generate_commands.py index 19719544..99607fbd 100755 --- a/docs/source/generate_commands.py +++ b/docs/source/generate_commands.py @@ -7,7 +7,7 @@ from alot.commands import * from alot.commands import COMMANDS import alot.buffers from argparse import HelpFormatter, SUPPRESS, OPTIONAL, ZERO_OR_MORE, ONE_OR_MORE, PARSER, REMAINDER -from alot.utils.booleanaction import BooleanAction +from alot.utils.argparse import BooleanAction from gettext import gettext as _ import collections as _collections import copy as _copy |