~chromakode/boots/nodes-async

« back to all changes in this revision

Viewing changes to src/boots/app/client_config.py

  • Committer: Max Goodman
  • Date: 2010-02-07 09:29:31 UTC
  • mfrom: (19.1.6 boots)
  • Revision ID: chromakode@gmail.com-20100207092931-cr8c0ovic2l0f97g
Merge Victoria's help system module and command history persistence.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
        to populate a config."""
43
43
 
44
44
        # Specify default values for a client configuration.
45
 
        self._defaults = {"command" : None,
46
 
                          "database" : None,
47
 
                          "script" : None,
48
 
                          'lingo' : 'sql',
49
 
                          "rcfile" : None,
50
 
                          "host" : "localhost",
51
 
                          "port" : 9306,
52
 
                          "username" : os.getenv("USER"),
53
 
                          "password" : False,
54
 
                          "prompt1" : "> ",
55
 
                          "prompt2" : "+ ",
56
 
                          "terminating_char" : ";"}
 
45
        self._defaults = {"command":            None,
 
46
                          "database":           None,
 
47
                          "script":             None,
 
48
                          'lingo':              'sql',
 
49
                          "rcfile":             None,
 
50
                          "host":               "localhost",
 
51
                          "port":               9306,
 
52
                          "username":           os.getenv("USER"),
 
53
                          "password":           False,
 
54
                          "prompt1":            "> ",
 
55
                          "prompt2":            "+ ",
 
56
                          "terminating_char":   ";",
 
57
                          "history_length":     100,
 
58
                          "history_file":       os.path.expanduser("~/.boots_history")}
57
59
        self._dict = self._defaults.copy()
58
60
 
59
61
        # Use default rc location in info if no argument is passed in.
118
120
                                    type = "string",
119
121
                                    dest = "terminating_char",
120
122
                                    help = "Specify the SQL statement terminating character. Default is ';'.")
121
 
 
 
123
        self._cli_parser.add_option("-F", "--historyfile",
 
124
                                    action = "store",
 
125
                                    type = "string",
 
126
                                    dest = "history_file",
 
127
                                    help = "Specify file to save history to")
 
128
        self._cli_parser.add_option("-L", "--historylength",
 
129
                                    action = "store",
 
130
                                    type = "int",
 
131
                                    dest = "history_length",
 
132
                                    help = "Specify max history file length")
 
133
 
122
134
    def __getitem__(self, key):
123
135
        return self._dict[key]
124
136