~romaimperator/keryx/devel

« back to all changes in this revision

Viewing changes to keryx.py

  • Committer: Chris Oliver
  • Date: 2009-10-02 18:11:28 UTC
  • Revision ID: excid3@gmail.com-20091002181128-rj7oxypvr11htt41
Error trapping in interactive CLI

Show diffs side-by-side

added added

removed removed

Lines of Context:
183
183
 
184
184
    def main(self):
185
185
        """Main loop for Keryx interactive CLI"""
 
186
        prompt = "%s:%s>" % (__appname__, self.name)
186
187
        if os.system("clear") != 0:
187
188
            os.system("cls")
188
189
        print "\nKeryx %s Interactive Command Line Interface\n" % __version__
189
190
        
190
191
        command = [""]
191
192
        while command[0] != "exit":
192
 
            command = raw_input("%s:%s>" % (__appname__, self.name)).strip().split()
 
193
            command = raw_input(prompt).strip().split()
193
194
            if command:
194
195
                if command[0] == "open":
195
196
                    if len(command) > 1:
203
204
                    self.project.Create()
204
205
                elif command[0] == "update":
205
206
                    self.project.UpdateInternet()
 
207
                else:
 
208
                    print "Command not found. Type 'help' for details."
206
209
            else:
 
210
                # No command input
207
211
                command = [""]
208
 
 
209
212
                        
210
213
 
211
214
# keryx <project-name> <command(s)> <option(s)>
212
215
if __name__ == '__main__':
213
216
    keryx = Keryx()
214
 
 
215
217
    no_errors = keryx.parse_options(argv)
216
 
 
217
218
    keryx.execute()