Repository: fniessink/next-action

Issue:
Change binary to next-action for consistency with application name

Discussion:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f34f269..0f35cce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,13 @@ 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]
+
+### Changed
+
+- Renamed Next-action's binary from `next_action` to `next-action` for consistency with the application and project name.
+
 ## [0.0.4] - 2018-05-10
 
 ### Added
diff --git a/README.md b/README.md
index 2d235e0..df935dd 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
 [![Codacy Badge](https://api.codacy.com/project/badge/Grade/746457c462cd4d9fa23f05424fa932b4)](https://www.codacy.com/app/frank_10/next-action?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=fniessink/next-action&amp;utm_campaign=Badge_Grade)
 [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/746457c462cd4d9fa23f05424fa932b4)](https://www.codacy.com/app/frank_10/next-action?utm_source=github.com&utm_medium=referral&utm_content=fniessink/next-action&utm_campaign=Badge_Coverage)
 
-Determine the next action to work on from a list of actions in a todo.txt file.
+Determine the next action to work on from a list of actions in a todo.txt file. Next-action is alpha-stage at the moment, so its options are rather limited at the moment.
 
 Don't know what todo.txt is? See <https://github.com/todotxt/todo.txt> for the todo.txt specification.
 
@@ -22,8 +22,8 @@ Next-action requires Python 3.6 or newer.
 ## Usage
 
 ```console
-$ next_action --help
-usage: next_action [-h] [--version] [-f FILE] [@CONTEXT]
+$ next-action --help
+usage: next-action [-h] [--version] [-f FILE] [@CONTEXT]
 
 Show the next action in your todo.txt
 
@@ -36,6 +36,22 @@ optional arguments:
   -f FILE, --file FILE  filename of the todo.txt file to read (default: todo.txt)
 ```
 
+Assuming your todo.txt file is in the current folder, running Next-action without arguments will show the next action you should do based on your tasks' priorities:
+
+```console
+$ next-action
+(A) Call mom @phone
+```
+
+You can limit the tasks from which Next-action picks the next action by passing a context:
+
+```console
+$ next-action @work
+(C) Finish proposal for important client @work
+```
+
+Since Next-action is still alpha-stage, this is it for the moment. Stay tuned for more options.
+
 ## Develop
 
 Clone the repository and run the unit tests with `python setup.py test`.
diff --git a/next_action/arguments.py b/next_action/arguments.py
index 8485bf5..6889cd5 100644
--- a/next_action/arguments.py
+++ b/next_action/arguments.py
@@ -23,7 +23,7 @@ def parse_arguments() -> argparse.Namespace:
 
     parser = argparse.ArgumentParser(description="Show the next action in your todo.txt",
                                      formatter_class=argparse.ArgumentDefaultsHelpFormatter)
-    parser.add_argument("--version", action="version", version="Next-action {0}".format(next_action.__version__))
+    parser.add_argument("--version", action="version", version="%(prog)s {0}".format(next_action.__version__))
     parser.add_argument("-f", "--file", help="filename of the todo.txt file to read",
                         type=str, default="todo.txt")
     parser.add_argument("context", metavar="@CONTEXT", help="Show the next action in the specified context", nargs="?",
diff --git a/setup.py b/setup.py
index 46d8260..4bb8d0d 100644
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,7 @@ and more.""",
     packages=find_packages(),
     entry_points={
         "console_scripts": [
-            "next_action=next_action.cli:next_action",
+            "next-action=next_action.cli:next_action",
         ],
     },
     test_suite="tests",


Test patch:
diff --git a/tests/unittests/test_arguments.py b/tests/unittests/test_arguments.py
index 3156a25..3c60285 100644
--- a/tests/unittests/test_arguments.py
+++ b/tests/unittests/test_arguments.py
@@ -9,37 +9,37 @@ from next_action.arguments import parse_arguments
 class ArgumentParserTest(unittest.TestCase):
     """ Unit tests for the argument parses. """
 
-    @patch.object(sys, "argv", ["next_action"])
+    @patch.object(sys, "argv", ["next-action"])
     def test_default_filename(self):
         """ Test that the argument parser has a default filename. """
         self.assertEqual("todo.txt", parse_arguments().file)
 
-    @patch.object(sys, "argv", ["next_action", "-f", "my_todo.txt"])
+    @patch.object(sys, "argv", ["next-action", "-f", "my_todo.txt"])
     def test_filename_argument(self):
         """ Test that the argument parser accepts a filename. """
         self.assertEqual("my_todo.txt", parse_arguments().file)
 
-    @patch.object(sys, "argv", ["next_action", "--file", "my_other_todo.txt"])
+    @patch.object(sys, "argv", ["next-action", "--file", "my_other_todo.txt"])
     def test_long_filename_argument(self):
         """ Test that the argument parser accepts a filename. """
         self.assertEqual("my_other_todo.txt", parse_arguments().file)
 
-    @patch.object(sys, "argv", ["next_action"])
+    @patch.object(sys, "argv", ["next-action"])
     def test_no_context(self):
         """ Test that the argument parser returns no context if the user doesn't pass one. """
         self.assertEqual(None, parse_arguments().context)
 
-    @patch.object(sys, "argv", ["next_action", "@home"])
+    @patch.object(sys, "argv", ["next-action", "@home"])
     def test_one_context(self):
         """ Test that the argument parser returns the context if the user passes one. """
         self.assertEqual("@home", parse_arguments().context)
 
-    @patch.object(sys, "argv", ["next_action", "home"])
+    @patch.object(sys, "argv", ["next-action", "home"])
     @patch.object(sys.stderr, "write")
     def test_faulty_context(self, mock_stderr_write):
         """ Test that the argument parser exits if the context is faulty. """
         os.environ['COLUMNS'] = "120"  # Fake that the terminal is wide enough.
         self.assertRaises(SystemExit, parse_arguments)
-        self.assertEqual([call("usage: next_action [-h] [--version] [-f FILE] [@CONTEXT]\n"),
-                          call("next_action: error: Contexts should start with an @.\n")],
+        self.assertEqual([call("usage: next-action [-h] [--version] [-f FILE] [@CONTEXT]\n"),
+                          call("next-action: error: Contexts should start with an @.\n")],
                          mock_stderr_write.call_args_list)
\ No newline at end of file
diff --git a/tests/unittests/test_cli.py b/tests/unittests/test_cli.py
index 3cdefe1..5b20ad6 100644
--- a/tests/unittests/test_cli.py
+++ b/tests/unittests/test_cli.py
@@ -10,7 +10,7 @@ from next_action import __version__
 class CLITest(unittest.TestCase):
     """ Unit tests for the command-line interface. """
 
-    @patch.object(sys, "argv", ["next_action"])
+    @patch.object(sys, "argv", ["next-action"])
     @patch("next_action.cli.open", mock_open(read_data=""))
     @patch.object(sys.stdout, "write")
     def test_empty_task_file(self, mock_stdout_write):
@@ -18,7 +18,7 @@ class CLITest(unittest.TestCase):
         next_action()
         self.assertEqual([call("Nothing to do!"), call("\n")], mock_stdout_write.call_args_list)
 
-    @patch.object(sys, "argv", ["next_action"])
+    @patch.object(sys, "argv", ["next-action"])
     @patch("next_action.cli.open", mock_open(read_data="Todo\n"))
     @patch.object(sys.stdout, "write")
     def test_one_task(self, mock_stdout_write):
@@ -26,7 +26,7 @@ class CLITest(unittest.TestCase):
         next_action()
         self.assertEqual([call("Todo"), call("\n")], mock_stdout_write.call_args_list)
 
-    @patch.object(sys, "argv", ["next_action"])
+    @patch.object(sys, "argv", ["next-action"])
     @patch("next_action.cli.open")
     @patch.object(sys.stdout, "write")
     def test_missing_file(self, mock_stdout_write, mock_open):
@@ -35,13 +35,13 @@ class CLITest(unittest.TestCase):
         next_action()
         self.assertEqual([call("Can't find todo.txt"), call("\n")], mock_stdout_write.call_args_list)
 
-    @patch.object(sys, "argv", ["next_action", "--help"])
+    @patch.object(sys, "argv", ["next-action", "--help"])
     @patch.object(sys.stdout, "write")
     def test_help(self, mock_stdout_write):
         """ Test the help message. """
         os.environ['COLUMNS'] = "120"  # Fake that the terminal is wide enough.
         self.assertRaises(SystemExit, next_action)
-        self.assertEqual(call("""usage: next_action [-h] [--version] [-f FILE] [@CONTEXT]
+        self.assertEqual(call("""usage: next-action [-h] [--version] [-f FILE] [@CONTEXT]
 
 Show the next action in your todo.txt
 
@@ -55,9 +55,9 @@ optional arguments:
 """),
                         mock_stdout_write.call_args_list[0])
 
-    @patch.object(sys, "argv", ["next_action", "--version"])
+    @patch.object(sys, "argv", ["next-action", "--version"])
     @patch.object(sys.stdout, "write")
     def test_version(self, mock_stdout_write):
         """ Test that --version shows the version number. """
         self.assertRaises(SystemExit, next_action)
-        self.assertEqual([call("Next-action {0}\n".format(__version__))], mock_stdout_write.call_args_list)
\ No newline at end of file
+        self.assertEqual([call("next-action {0}\n".format(__version__))], mock_stdout_write.call_args_list)
\ No newline at end of file