Repository: fniessink/next-action

Issue:
next-action -pA isn't interpreted as next-action -p A

Discussion:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bbdd695..eb96b4e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
 and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
 
+## [Unreleased]
+
+### Fixed
+
+- Short options immediately followed by a value weren't parsed correctly. Fixes #84.
+
 ## [0.16.1] - 2018-06-04
 
 ### Fixed
diff --git a/next_action/arguments/parser.py b/next_action/arguments/parser.py
index 725d787..0d7a4b1 100644
--- a/next_action/arguments/parser.py
+++ b/next_action/arguments/parser.py
@@ -153,7 +153,8 @@ class NextActionArgumentParser(argparse.ArgumentParser):
     @staticmethod
     def arguments_not_specified(*arguments: str) -> bool:
         """ Return whether any of the arguments was specified on the command line. """
-        return all([argument not in sys.argv for argument in arguments])
+        return not any([command_line_arg.startswith(argument) for argument in arguments
+                        for command_line_arg in sys.argv])
 
     def fix_filenames(self, namespace: argparse.Namespace) -> None:
         """ Fix the filenames. """


Test patch:
diff --git a/tests/unittests/arguments/test_config.py b/tests/unittests/arguments/test_config.py
index 8eb5728..12e9a15 100644
--- a/tests/unittests/arguments/test_config.py
+++ b/tests/unittests/arguments/test_config.py
@@ -270,13 +270,19 @@ class PriorityTest(ConfigTestCase):
     @patch.object(sys, "argv", ["next-action", "--priority", "M"])
     @patch.object(config, "open", mock_open(read_data="priority: Z"))
     def test_override_priority(self):
-        """ Test that a command line style overrides the priority in the config file. """
+        """ Test that a command line option overrides the priority in the config file. """
+        self.assertEqual("M", parse_arguments()[1].priority)
+
+    @patch.object(sys, "argv", ["next-action", "-pM"])
+    @patch.object(config, "open", mock_open(read_data="priority: Z"))
+    def test_override_short(self):
+        """ Test that a short command line option overrides the priority in the config file. """
         self.assertEqual("M", parse_arguments()[1].priority)
 
     @patch.object(sys, "argv", ["next-action", "--priority"])
     @patch.object(config, "open", mock_open(read_data="priority: Z"))
     def test_cancel_priority(self):
-        """ Test that a command line style overrides the priority in the config file. """
+        """ Test that a command line option overrides the priority in the config file. """
         self.assertEqual(None, parse_arguments()[1].priority)
 
     @patch.object(sys, "argv", ["next-action"])