/stdhome

To get this branch, use:
bzr branch http://bzr.ed.am/stdhome

« back to all changes in this revision

Viewing changes to lib/stdhome/program.py

  • Committer: Tim Marston
  • Date: 2014-04-18 14:41:07 UTC
  • Revision ID: tim@ed.am-20140418144107-rl879gdqybbc6ria
moved config to its own file and read-in ignore lists

Show diffs side-by-side

added added

removed removed

19
19
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
20
 
21
21
 
22
 
import os, sys, getopt, ConfigParser
 
22
import os, sys, getopt
23
23
import the
 
24
from config import Config
24
25
from vcs.vcs import Vcs
25
26
 
26
27
 
146
147
                        pass
147
148
 
148
149
                # read program configuration
149
 
                self.read_config()
 
150
                the.config = Config()
150
151
 
151
152
                # the first argument should be the command
152
153
                the.command = sys.argv[ 1 ] if len( sys.argv ) > 1 else None
188
189
                        instance.run()
189
190
                except Vcs.VcsError as e:
190
191
                        message = e.msg.rstrip()
191
 
                        if the.verbose:
 
192
                        if the.verbose >= 1:
192
193
                                message += '\n\nOUTPUT:\n' + e.output.rstrip()
193
194
                        self.die( message )
194
195
                except self.FatalError as e:
195
196
                        self.die( e.msg )
196
197
 
197
198
 
198
 
        def read_config( self ):
199
 
                config = ConfigParser.SafeConfigParser( allow_no_value = True )
200
 
                config.read( the.config_file )
201
 
                if config.has_option( 'stdhome', 'home-dir' ):
202
 
                        the.home_dir = config.get( 'stdhome', 'home-dir' )
203
 
 
204
 
 
205
199
        class UsageError( Exception ):
206
200
 
207
201
                def __init__( self, error_message ):