commit:     7358377160a877f920683324d7fee8b11a82ea93
Author:     Noel Nyback <noel <AT> nyback <DOT> com>
AuthorDate: Thu Jan 19 20:48:21 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Feb 15 07:53:21 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=73583771

emaint: Changed default action for emaint target sync to 'auto'

When using 'sync' module of emaint the default option is '--check' when
none is provided which spits out an ERROR about '--check' not being an option 
for module 'sync':
```
terminal ~ # emaint sync

ERROR: module 'sync' does not have option '--check'

sync module options:
-A, --allrepos (sync module only): -A, --allrepos  Sync all repos that have a 
sync-url defined
-a, --auto    (sync module only): -a, --auto  Sync auto-sync enabled repos only
-r, --repo    (sync module only): -r, --repo  Sync the specified repo
```

My idea was to change the default action for the 'sync' module to '--auto'. To 
me '--auto'
seems to be the most useful default option for the 'sync' module since I would 
imagine
that is the most common use case and presumably most users typing 'emaint sync' 
would
be looking for this outcome.

Closes: https://github.com/gentoo/portage/pull/981
Signed-off-by: Noel Nyback <noel <AT> nyback.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 NEWS                       |  2 ++
 lib/portage/emaint/main.py | 14 ++++++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index d81d5823f..881565634 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ Bug fixes:
 
 * portage(5): List volatile option as a separate entry (bug #888585).
 
+* emaint: Changed default action for emaint target sync to 'auto'.
+
 portage-3.0.44 (2023-01-15)
 --------------
 

diff --git a/lib/portage/emaint/main.py b/lib/portage/emaint/main.py
index af7420368..791adecfd 100644
--- a/lib/portage/emaint/main.py
+++ b/lib/portage/emaint/main.py
@@ -210,10 +210,16 @@ def emaint_main(myargv):
             long_action = opt.long.lstrip("-")
 
     if long_action is None:
-        # print("DEBUG: long_action is None: setting to 'check'")
-        long_action = "check"
-        func = check_opt.func
-        status = check_opt.status
+        if args[0] == "sync":
+            # print("DEBUG: long_action is None: setting to 'auto'")
+            long_action = "auto"
+            func = "auto_sync"
+            status = "Syncing %s"
+        else:
+            # print("DEBUG: long_action is None: setting to 'check'")
+            long_action = "check"
+            func = check_opt.func
+            status = check_opt.status
 
     if args[0] == "all":
         tasks = []

Reply via email to