From e3517048c250b3008f72811727195155f5a57129 Mon Sep 17 00:00:00 2001
From: Sebastien Luttringer <sebastien.luttringer@smartjog.com>
Date: Thu, 8 Dec 2011 14:26:23 +0100
Subject: [PATCH] new display and option for command repo

repo have now -s and -u option
new display and color
---
 bin/is                       | 10 +++++-----
 completion/bash/is           |  2 +-
 installsystems/repository.py | 13 +++++++++----
 3 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/bin/is b/bin/is
index db18395..0e095e4 100755
--- a/bin/is
+++ b/bin/is
@@ -304,7 +304,7 @@ def c_repo(parser, args):
     repoman = load_repositories(args)
     for pattern in args.repository:
         repoman.show_repos(pattern, online=args.online, local=args.local,
-                           url=args.verbose, state=not args.no_state)
+                           url=args.url, state=args.state)
 
 def c_search(parser, args):
     '''
@@ -566,10 +566,10 @@ p_repo_mgroup.add_argument("-o", "--online", action="store_true", default=None,
                            help="list online repository (filter)")
 p_repo_mgroup.add_argument("-O", "--offline", action="store_false", dest="online",
                            help="list offline repository (filter)")
-p_repo.add_argument("-S", "--no-state", action="store_true", default=False,
-                    help="doesn't display repository state (online/offline)")
-p_repo.add_argument("-v", "--verbose", action="store_true", default=False,
-                    help="verbose output")
+p_repo.add_argument("-s", "--state", action="store_true", default=False,
+                    help="display repository state (online/offline/local/remote)")
+p_repo.add_argument("-u", "--url", action="store_true", default=False,
+                    help="display repository url")
 p_repo.add_argument("repository", nargs='*', default=["*"], help="repository pattern")
 p_repo.set_defaults(func=c_repo)
 
diff --git a/completion/bash/is b/completion/bash/is
index 4bd6b97..87d5f3c 100644
--- a/completion/bash/is
+++ b/completion/bash/is
@@ -139,7 +139,7 @@ _is() {
             _filedir -d
             ;;
 	repo)
-            [[ "$cur" == -* ]] && _opt '-h --help -v --verbose -l --local -r --remote -o --online -O --offline -S --no-state --force-offline' && return 0
+            [[ "$cur" == -* ]] && _opt '-h --help -l --local -r --remote -o --online -O --offline -s --state --force-offline -u --url' && return 0
 	    _repo
 	    ;;
 	search)
diff --git a/installsystems/repository.py b/installsystems/repository.py
index fda172f..77a60ea 100644
--- a/installsystems/repository.py
+++ b/installsystems/repository.py
@@ -643,11 +643,16 @@ class RepositoryManager(object):
                 continue
             if not repo.local and local is True:
                 continue
-            s = "#light##blue#%s#reset#"% repo.config.name
+            so = "#l##r#Off#R# " if repo.config.offline else "#l##g#On#R#  "
+            sl = "#l##y#Local#R#  " if repo.local else "#l##c#Remote#R# "
+            rc = "#l##r#" if repo.config.offline else "#l##g#"
+            s = ""
+            if state:
+                s +=  "%s%s " % (so, sl)
+                rc = "#l##b#"
+            s += "%s%s#R#"% (rc, repo.config.name)
             if url:
-                s += " (%s)" % repo.config.path
-            if state and repo.config.offline:
-                s +=  " #light##red#[offline]#reset#"
+                s += "  (%s)" % repo.config.path
             out(s)
 
     def show_images(self, pattern, o_json=False, o_long=False,
-- 
GitLab