diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2864bbb..5ced4b2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
 ### Fixed
 
 - When generating a configuration file with `--write-config-file` also include context and project filters passed on the command-line. Closes #141.
+- When generating a configuration file with `--write-config-file` also include the minimum priority if passed on the command-line. Closes #142.
 
 ## [1.5.0] - 2018-06-30
 
diff --git a/README.md b/README.md
index 279bfb1..69b3265 100644
--- a/README.md
+++ b/README.md
@@ -291,12 +291,13 @@ To make this the configuration that *Next-action* reads by default, redirect the
 Any additional options specified on the command line are used to generate the configuration file:
 
 ```console
-$ next-action --write-config-file --number 3 --file ~/tasks.txt --style fruity -@waiting
+$ next-action --write-config-file --number 3 --file ~/tasks.txt --style fruity --priority Z -@waiting
 # Configuration file for Next-action. Edit the settings below as you like.
 file: ~/tasks.txt
 filters:
 - -@waiting
 number: 3
+priority: Z
 reference: multiple
 style: fruity
 ```
@@ -447,9 +448,9 @@ To run the unit tests:
 
 ```console
 $ python -m unittest
-.........................................................................................................................................................................................................................................
+..........................................................................................................................................................................................................................................
 ----------------------------------------------------------------------
-Ran 233 tests in 2.089s
+Ran 234 tests in 2.059s
 
 OK
 ```
@@ -460,9 +461,9 @@ To create the unit test coverage report run the unit tests under coverage with:
 
 ```console
 $ coverage run --branch -m unittest
-.........................................................................................................................................................................................................................................
+..........................................................................................................................................................................................................................................
 ----------------------------------------------------------------------
-Ran 233 tests in 3.098s
+Ran 234 tests in 2.740s
 
 OK
 ```
@@ -474,7 +475,7 @@ $ coverage report --fail-under=100 --omit=".venv/*" --skip-covered
 Name    Stmts   Miss Branch BrPart  Cover
 -----------------------------------------
 -----------------------------------------
-TOTAL    1320      0    168      0   100%
+TOTAL    1329      0    170      0   100%
 
 25 files skipped due to complete coverage.
 ```
diff --git a/next_action/arguments/config.py b/next_action/arguments/config.py
index d273327..3c50661 100644
--- a/next_action/arguments/config.py
+++ b/next_action/arguments/config.py
@@ -42,6 +42,8 @@ def write_config_file(namespace: argparse.Namespace) -> None:
         options["all"] = True
     else:
         options["number"] = namespace.number
+    if namespace.priority:
+        options["priority"] = namespace.priority
     config = yaml.dump(options, default_flow_style=False)
     sys.stdout.write(intro + config)
 

--write-config-file ignores --priority
diff --git a/tests/unittests/arguments/test_config.py b/tests/unittests/arguments/test_config.py
index bab1c3a..134a73a 100644
--- a/tests/unittests/arguments/test_config.py
+++ b/tests/unittests/arguments/test_config.py
@@ -107,7 +107,7 @@ class WriteConfigFileTest(ConfigTestCase):
         self.assertEqual([call(expected)], mock_stdout_write.call_args_list)
 
     @patch.object(sys, "argv", ["next-action", "--write-config-file", "--number", "3", "--reference", "never",
-                                "--style", "fruity", "--file", "~/tasks.txt", "@context", "+project",
+                                "--style", "fruity", "--file", "~/tasks.txt", "--priority", "Z", "@context", "+project",
                                 "-@excluded_context", "-+excluded_project"])
     @patch.object(config, "open", mock_open(read_data=""))
     @patch.object(sys.stdout, "write")
@@ -116,7 +116,7 @@ class WriteConfigFileTest(ConfigTestCase):
         self.assertRaises(SystemExit, parse_arguments)
         expected = "# Configuration file for Next-action. Edit the settings below as you like.\n" \
             "file: ~/tasks.txt\nfilters:\n- '@context'\n- +project\n- -@excluded_context\n- -+excluded_project\n" \
-            "number: 3\nreference: never\nstyle: fruity\n"
+            "number: 3\npriority: Z\nreference: never\nstyle: fruity\n"
         self.assertEqual([call(expected)], mock_stdout_write.call_args_list)
 
     @patch.object(sys, "argv", ["next-action", "--write-config-file", "--file", "~/tasks.txt", "--file", "project.txt"])
@@ -139,6 +139,16 @@ class WriteConfigFileTest(ConfigTestCase):
         expected += "all: true\nfile: ~/todo.txt\nreference: multiple\nstyle: default\n"
         self.assertEqual([call(expected)], mock_stdout_write.call_args_list)
 
+    @patch.object(sys, "argv", ["next-action", "--write-config-file", "--priority"])
+    @patch.object(config, "open", mock_open(read_data=""))
+    @patch.object(sys.stdout, "write")
+    def test_priority(self, mock_stdout_write):
+        """ Test that priority without argument is processed correctly. """
+        self.assertRaises(SystemExit, parse_arguments)
+        expected = "# Configuration file for Next-action. Edit the settings below as you like.\n"
+        expected += "file: ~/todo.txt\nnumber: 1\nreference: multiple\nstyle: default\n"
+        self.assertEqual([call(expected)], mock_stdout_write.call_args_list)
+
     @patch.object(sys, "argv", ["next-action", "--write-config-file"])
     @patch.object(config, "open", mock_open(read_data="number: 3"))
     @patch.object(sys.stdout, "write")

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
backports.zoneinfo==0.2.1
Cerberus==1.2
certifi==2021.5.30
dateparser==0.7.0
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
-e git+https://github.com/fniessink/next-action.git@8c023e2fa35c31157f59dfca82ff71699f55115b#egg=next_action
packaging==21.3
pluggy==1.0.0
py==1.11.0
Pygments==2.2.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
pytz-deprecation-shim==0.1.0.post0
PyYAML==3.12
regex==2023.8.8
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
tzdata==2025.2
tzlocal==4.2
zipp==3.6.0

name: next-action
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - backports-zoneinfo==0.2.1
      - cerberus==1.2
      - dateparser==0.7.0
      - importlib-metadata==4.8.3
      - importlib-resources==5.4.0
      - iniconfig==1.1.1
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pygments==2.2.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - pytz-deprecation-shim==0.1.0.post0
      - pyyaml==3.12
      - regex==2023.8.8
      - six==1.17.0
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - tzdata==2025.2
      - tzlocal==4.2
      - zipp==3.6.0
prefix: /opt/conda/envs/next-action

tests/unittests/arguments/test_config.py::WriteConfigFileTest::test_with_args
tests/unittests/arguments/test_config.py::ReadConfigFileTest::test_empty_file tests/unittests/arguments/test_config.py::ReadConfigFileTest::test_error_opening tests/unittests/arguments/test_config.py::ReadConfigFileTest::test_error_parsing tests/unittests/arguments/test_config.py::ReadConfigFileTest::test_file_not_found tests/unittests/arguments/test_config.py::ReadConfigFileTest::test_invalid_document tests/unittests/arguments/test_config.py::ReadConfigFileTest::test_missing_default_config tests/unittests/arguments/test_config.py::ReadConfigFileTest::test_no_file_key tests/unittests/arguments/test_config.py::ReadConfigFileTest::test_skip_config tests/unittests/arguments/test_config.py::WriteConfigFileTest::test_default_file tests/unittests/arguments/test_config.py::WriteConfigFileTest::test_multiple_files tests/unittests/arguments/test_config.py::WriteConfigFileTest::test_priority tests/unittests/arguments/test_config.py::WriteConfigFileTest::test_read_config tests/unittests/arguments/test_config.py::WriteConfigFileTest::test_show_all tests/unittests/arguments/test_config.py::FilenameTest::test_cli_takes_precedence tests/unittests/arguments/test_config.py::FilenameTest::test_invalid_filename tests/unittests/arguments/test_config.py::FilenameTest::test_valid_and_invalid tests/unittests/arguments/test_config.py::FilenameTest::test_valid_file tests/unittests/arguments/test_config.py::FilenameTest::test_valid_files tests/unittests/arguments/test_config.py::NumberTest::test_all_and_number tests/unittests/arguments/test_config.py::NumberTest::test_all_false tests/unittests/arguments/test_config.py::NumberTest::test_all_true tests/unittests/arguments/test_config.py::NumberTest::test_argument_all_overrides tests/unittests/arguments/test_config.py::NumberTest::test_argument_nr_overrides tests/unittests/arguments/test_config.py::NumberTest::test_cli_takes_precedence tests/unittests/arguments/test_config.py::NumberTest::test_invalid_number tests/unittests/arguments/test_config.py::NumberTest::test_valid_number tests/unittests/arguments/test_config.py::NumberTest::test_zero tests/unittests/arguments/test_config.py::ConfigStyleTest::test_cancel_style tests/unittests/arguments/test_config.py::ConfigStyleTest::test_invalid_style tests/unittests/arguments/test_config.py::ConfigStyleTest::test_override_style tests/unittests/arguments/test_config.py::ConfigStyleTest::test_valid_style tests/unittests/arguments/test_config.py::PriorityTest::test_cancel_priority tests/unittests/arguments/test_config.py::PriorityTest::test_invalid_priority tests/unittests/arguments/test_config.py::PriorityTest::test_override_priority tests/unittests/arguments/test_config.py::PriorityTest::test_override_short tests/unittests/arguments/test_config.py::PriorityTest::test_valid_priority tests/unittests/arguments/test_config.py::ReferenceTest::test_invalid_priority tests/unittests/arguments/test_config.py::ReferenceTest::test_override tests/unittests/arguments/test_config.py::ReferenceTest::test_valid_reference tests/unittests/arguments/test_config.py::FiltersTest::test_context tests/unittests/arguments/test_config.py::FiltersTest::test_context_list tests/unittests/arguments/test_config.py::FiltersTest::test_contexts tests/unittests/arguments/test_config.py::FiltersTest::test_excluded_context tests/unittests/arguments/test_config.py::FiltersTest::test_excluded_project tests/unittests/arguments/test_config.py::FiltersTest::test_ignore_project_not_context tests/unittests/arguments/test_config.py::FiltersTest::test_invalid_filter_list tests/unittests/arguments/test_config.py::FiltersTest::test_invalid_filter_string tests/unittests/arguments/test_config.py::FiltersTest::test_inverse_project tests/unittests/arguments/test_config.py::FiltersTest::test_project tests/unittests/arguments/test_config.py::FiltersTest::test_projects tests/unittests/arguments/test_config.py::FiltersTest::test_same_project
next_action/arguments/config.py README.md CHANGELOG.md
next_action/arguments/config.py README.md CHANGELOG.md