#!/usr/bin/env python # Copyright (C) 2012 Aleksey Lim # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from sugar_network.toolkit import application, sugar from active_toolkit.options import Option from active_toolkit import enforce command = Option( 'if context implementation supports several commands, ' \ 'specify one of them to launch', default='activity', short_option='-C') class Application(application.Application): @application.command( 'CONTEXT [RESTRICTION] [ARGS]\n' 'if context is associatad with software, launch one of its ' 'implementations') def launch(self): enforce(self.args, 'Context is not specified') #context = self.args.pop(0) raise NotImplementedError() @application.command( 'CONTEXT\n' 'if context is associatad with software, download one of its ' 'implementations and place it to ~/Activities') def checkin(self): enforce(self.args, 'Context is not specified') #context = self.args.pop(0) raise NotImplementedError() @application.command( 'CONTEXT\n' 'delete all implementations downloaded by "checkin" command') def checkout(self): enforce(self.args, 'Context is not specified') #context = self.args.pop(0) raise NotImplementedError() # New defaults application.debug.value = sugar.logger_level() Option.seek('sugar-network') Option.seek('sugar-network', [application.debug]) app = Application( name='sugar-network', description='Sugar Network client utility', epilog='See http://wiki.sugarlabs.org/go/Sugar_Network ' \ 'for details.', where={ 'CONTEXT': 'context GUID or name context should implement', 'RESTRICTION': 'particular context implementation in form of:\n' \ '=|>=|< VERSION', 'ARGS': 'arbitrary command-line arguments to pass as-is to ' \ 'launching context implementation', }, config_files=[ '/etc/sweets.conf', '~/.config/sweets/config', sugar.profile_path('sweets.conf'), ], stop_args=['launch']) app.start()