diff options
author | Dylan Baker <baker.dylan.c@gmail.com> | 2017-02-01 10:41:41 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-01 10:41:41 -0800 |
commit | 567f4c2d8233e83b0489145064af662dbc010e00 (patch) | |
tree | 5ab12d4fe9093e56aec8d13b44fa3f576d3cf697 /alot/commands | |
parent | b29da9cdcda59b262e3df2a1fb739a33311b2165 (diff) | |
parent | a030da17b4c450440f8dd8d5a5f828a272656c5a (diff) |
Merge pull request #1019 from dcbaker/pr/more-unittests
more unittests
Diffstat (limited to 'alot/commands')
-rw-r--r-- | alot/commands/__init__.py | 2 | ||||
-rw-r--r-- | alot/commands/envelope.py | 14 |
2 files changed, 7 insertions, 9 deletions
diff --git a/alot/commands/__init__.py b/alot/commands/__init__.py index 5df88747..6b84a50b 100644 --- a/alot/commands/__init__.py +++ b/alot/commands/__init__.py @@ -101,6 +101,8 @@ class registerCommand(object): definition is decorated to register it as handler for 'save' in mode 'thread' and add boolean and string arguments:: + .. code-block:: + @registerCommand('thread', 'save', arguments=[ (['--all'], {'action': 'store_true', 'help':'save all'}), (['path'], {'nargs':'?', 'help':'path to save to'})], diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index d0dce4be..82b87888 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -39,7 +39,7 @@ class AttachCommand(Command): """attach files to the mail""" repeatable = True - def __init__(self, path=None, **kwargs): + def __init__(self, path, **kwargs): """ :param path: files to attach (globable string) :type path: str @@ -50,14 +50,10 @@ class AttachCommand(Command): def apply(self, ui): envelope = ui.current_buffer.envelope - if self.path: # TODO: not possible, otherwise argparse error before - files = [g for g in glob.glob(os.path.expanduser(self.path)) - if os.path.isfile(g)] - if not files: - ui.notify('no matches, abort') - return - else: - ui.notify('no files specified, abort') + files = [g for g in glob.glob(os.path.expanduser(self.path)) + if os.path.isfile(g)] + if not files: + ui.notify('no matches, abort') return logging.info("attaching: %s", files) |