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). '''
