source: trunk/sara_cmt/sara_cmt/parser.py @ 14194

Last change on this file since 14194 was 14194, checked in by sil, 12 years ago

Merged branch 1.0 (until tag 1.0.0) back to trunk

File size: 1.3 KB
Line 
1#    This file is part of CMT, a Cluster Management Tool made at SARA.
2#    Copyright (C) 2012  Sil Westerveld
3#
4#    This program is free software; you can redistribute it and/or modify
5#    it under the terms of the GNU General Public License as published by
6#    the Free Software Foundation; either version 2 of the License, or
7#    (at your option) any later version.
8#
9#    This program is distributed in the hope that it will be useful,
10#    but WITHOUT ANY WARRANTY; without even the implied warranty of
11#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12#    GNU General Public License for more details.
13#
14#    You should have received a copy of the GNU General Public License
15#    along with this program; if not, write to the Free Software
16#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
18import optparse
19
20
21class Parser:
22    """
23        Optionparser, implemented with the borg design pattern.
24    """
25    __shared_state = {}
26
27    # Check for existence of a global parser object, otherwise make one
28    if 'parser' not in __shared_state.keys():
29        __shared_state['parser'] = optparse.OptionParser()
30
31    def __init__(self):
32        self.__dict__ = self.__shared_state
33
34    def getParser(self):
35        return self.__dict__['parser']
Note: See TracBrowser for help on using the repository browser.