changeset 8435:1a93dc58f975

feat: add 'q' as alias to quit to exit interactive roundup-admin Also require no arguments to 'q', 'quit' or 'exit' before exiting. Now typing 'quit a' will get an unknown command error. Add to admin-guide how to get out of interactive mode. Also test 'q' and 'exit' commands. No upgrading docs added. Not that big a feature. Just noted in CHANGES. Reporting error if argument provided is unlikely to be an issue IMO, so no upgrading.txt entry.
author John Rouillard <rouilj@ieee.org>
date Tue, 26 Aug 2025 23:37:42 -0400
parents 66284037142e
children d89d0147dd17
files CHANGES.txt doc/admin_guide.txt roundup/admin.py test/test_admin.py
diffstat 4 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Tue Aug 26 23:06:40 2025 -0400
+++ b/CHANGES.txt	Tue Aug 26 23:37:42 2025 -0400
@@ -34,6 +34,8 @@
   properly entered, the change is committed. (John Rouillard)
 - add support for dictConfig style logging configuration. Ini/File
   style configs will still be supported. (John Rouillard)
+- add 'q' as alias for quit in roundup-admin interactive mode. (John
+  Rouillard)
 
 2025-07-13 2.5.0
 
--- a/doc/admin_guide.txt	Tue Aug 26 23:06:40 2025 -0400
+++ b/doc/admin_guide.txt	Tue Aug 26 23:37:42 2025 -0400
@@ -2067,6 +2067,9 @@
  Commands may be abbreviated as long as the abbreviation
  matches only one command, e.g. l == li == lis == list.
 
+In interactive mode entering: ``q``, ``quit``, or ``exit`` alone on a
+line will exit the program.
+
 One thing to note, The ``-u user`` setting does not currently operate
 like a user logging in via the web. The user running roundup-admin
 must have read access to the tracker home directory. As a result the
--- a/roundup/admin.py	Tue Aug 26 23:06:40 2025 -0400
+++ b/roundup/admin.py	Tue Aug 26 23:37:42 2025 -0400
@@ -2415,7 +2415,8 @@
             except ValueError:
                 continue        # Ignore invalid quoted token
             if not args: continue  # noqa: E701
-            if args[0] in ('quit', 'exit'): break   # noqa: E701
+            if args[0] in ('q', 'quit', 'exit') and len(args) == 1:
+                break   # noqa: E701
             self.run_command(args)
 
         # exit.. check for transactions
--- a/test/test_admin.py	Tue Aug 26 23:06:40 2025 -0400
+++ b/test/test_admin.py	Tue Aug 26 23:37:42 2025 -0400
@@ -150,7 +150,7 @@
         expected = 'ready for input.\nType "help" for help.'
         self.assertEqual(expected, out[-1*len(expected):])
 
-        inputs = iter(["list user", "quit"])
+        inputs = iter(["list user", "q"])
 
         AdminTool.my_input = lambda _self, _prompt: next(inputs)
 
@@ -1067,7 +1067,7 @@
 
         # must set verbose to see _reopen_tracker hidden setting.
         # and to get "Reopening tracker" verbose log output
-        inputs = iter(["pragma verbose=true", "pragma list", "quit"])
+        inputs = iter(["pragma verbose=true", "pragma list", "exit"])
         AdminTool.my_input = lambda _self, _prompt: next(inputs)
 
         self.install_init()

Roundup Issue Tracker: http://roundup-tracker.org/