public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Devan Franchini" <twitch153@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/layman:gsoc2014 commit in: layman/
Date: Fri, 15 Aug 2014 22:32:35 +0000 (UTC)	[thread overview]
Message-ID: <1408136258.ba74abf654a9592841cdf114fcd61dddc15350e0.twitch153@gentoo> (raw)

commit:     ba74abf654a9592841cdf114fcd61dddc15350e0
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 10 20:30:20 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Aug 15 20:57:38 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=ba74abf6

cli.py: Adds disable and enable cli functions

argsparser.py: Adds --disable and --enable cli args.

X-Gentoo-Bug: 512316
X-Gentoo-Bug-URL: https://bugs.gentoo.org/512316

---
 layman/argsparser.py | 12 ++++++++++++
 layman/cli.py        | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index 56813f0..aa8c291 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -95,6 +95,18 @@ class ArgsParser(BareConfig):
                              help = 'Remove the given overlay from your locally inst'
                              'alled overlays. Specify "ALL" to remove all overlays.')
 
+        actions.add_argument('-D',
+                             '--disable',
+                             nargs = '+',
+                             help = 'Disable the given overlay from portage. Specify'
+                             ' "ALL" to disable all installed overlay.')
+
+        actions.add_argument('-E',
+                             '--enable',
+                             nargs = '+',
+                             help = 'Re-enable a previously disabled overlay. Specif'
+                             'y "ALL" to enable all installed overlays.')
+
         actions.add_argument('-f',
                              '--fetch',
                              action = 'store_true',

diff --git a/layman/cli.py b/layman/cli.py
index 28b19fb..bb84081 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -146,6 +146,8 @@ class Main(object):
                         ('sync_all',   'Sync'),
                         ('readd',      'Readd'),
                         ('delete',     'Delete'),
+                        ('disable',    'Disable'),
+                        ('enable',     'Enable'),
                         ('list',       'ListRemote'),
                         ('list_local', 'ListLocal'),]
 
@@ -300,6 +302,44 @@ class Main(object):
         return result
 
 
+    def Disable(self):
+        '''
+        Disable the selected overlay(s).
+
+        @rtype bool
+        '''
+        self.output.info('Disabling selected overlay(s),...', 2)
+        selection = decode_selection(self.config['disable'])
+        if ALL_KEYWORD in selection:
+            selection = self.api.get_installed()
+        result = self.api.disable_repos(selection)
+        if result:
+            self.output.info('Successfully disabled overlay(s) ' +
+                ', '.join((x.decode('UTF-8') if isinstance(x, bytes) else x) for x in selection) +
+                '.', 2)
+        self.output.notice('')
+        return result
+
+
+    def Enable(self):
+        '''
+        Enable the selected overlay(s).
+
+        @rtype bool
+        '''
+        self.output.info('Enabling the selected overlay(s),...', 2)
+        selection = decode_selection(self.config['enable'])
+        if ALL_KEYWORD in selection:
+            selection = self.api.get_installed()
+        result = self.api.enable_repos(selection)
+        if result:
+            self.output.info('Successfully enable overlay(s) ' +
+                ', '.join((x.decode('UTF-8') if isinstance(x, bytes) else x) for x in selection) +
+                '.', 2)
+        self.output.notice('')
+        return result
+
+
     def Info(self):
         ''' Print information about the specified overlay(s).
         '''


             reply	other threads:[~2014-08-15 22:32 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-15 22:32 Devan Franchini [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-08-15 23:59 [gentoo-commits] proj/layman:master commit in: layman/ Devan Franchini
2014-08-16  0:00 ` [gentoo-commits] proj/layman:gsoc2014 " Devan Franchini
2014-08-15 22:32 Devan Franchini
2014-08-15 22:32 Devan Franchini
2014-08-15 22:32 Devan Franchini
2014-06-27  4:07 Devan Franchini
2014-06-27  4:07 Devan Franchini
2014-06-27  4:07 Devan Franchini
2014-06-16  3:40 [gentoo-commits] proj/layman:master " Brian Dolbec
2014-06-16  3:37 ` [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec
2014-06-16  3:40 [gentoo-commits] proj/layman:master " Brian Dolbec
2014-06-16  3:37 ` [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec
2014-06-16  3:40 [gentoo-commits] proj/layman:master " Brian Dolbec
2014-06-16  3:37 ` [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec
2014-06-16  3:37 Brian Dolbec
2014-06-16  3:37 Brian Dolbec
2014-06-16  3:37 Brian Dolbec
2014-06-16  3:37 Brian Dolbec
2014-05-16  2:30 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  0:58 Devan Franchini
2014-05-16  0:58 Devan Franchini
2014-05-16  0:57 Devan Franchini
2014-05-15 20:46 Devan Franchini
2014-05-15 20:46 Devan Franchini
2014-05-15 20:37 Devan Franchini
2014-05-15 20:30 Devan Franchini
2014-05-15 20:02 Devan Franchini
2014-05-15  0:04 Devan Franchini
2014-05-14 23:54 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 22:16 Devan Franchini
2014-05-14 22:08 Devan Franchini
2014-05-14 21:42 Devan Franchini
2014-05-14 21:30 Devan Franchini
2014-05-14 21:15 Devan Franchini
2014-05-14 21:15 Devan Franchini
2014-05-14 19:29 Devan Franchini
2014-05-14 18:55 Devan Franchini
2014-05-14 18:44 Devan Franchini
2014-05-14 17:32 Devan Franchini
2014-05-14  3:21 Devan Franchini
2014-05-14  0:37 Devan Franchini
2014-05-07 22:21 Devan Franchini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1408136258.ba74abf654a9592841cdf114fcd61dddc15350e0.twitch153@gentoo \
    --to=twitch153@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox