def run(self): print('tiget {}'.format(__version__)) print('Type "help" for help') print('') readline.parse_and_bind('tab: complete') try: readline.read_history_file(self.histfile) except IOError: pass # The file might not exist yet while True: self.lineno += 1 try: line = self.readline() if line in ('quit', 'exit'): raise EOFError(line) except KeyboardInterrupt: continue except EOFError: break try: cmd_exec(line) except CmdError as e: print_error('"<repl>", line {}: {}'.format(self.lineno, e)) except: post_mortem() readline.set_history_length(settings.core.history_limit) readline.write_history_file(self.histfile)
def main(): load_plugin('tiget.core') try: init_repo() except GitError as e: print_error(e) sys.exit(1) except Exception as e: post_mortem() sys.exit(1)
def main(): parser = ArgumentParser(description='ticketing system with git backend') parser.add_argument( '-i', '--interactive', action='store_true', default=sys.stdin.isatty(), help='force start of an interactive session, even if stdin is no tty') parser.add_argument( '-n', '--no-config', action='store_false', dest='load_config', default=True, help='prevent loading of default configuration files') parser.add_argument( '-v', '--version', action='store_true', dest='print_version', default=False, help='print version information') parser.add_argument('cmd', nargs=REMAINDER, help='execute a command') args = parser.parse_args() if args.print_version: print('tiget {}'.format(__version__)) return load_plugin('tiget.core') if not is_repo_initialized(): print_error('repository is not initialized; use tiget-setup') sys.exit(1) try: if args.load_config: load_config() if args.cmd: cmd_execv(args.cmd) elif args.interactive: Repl().run() else: cmd_execfile(sys.stdin) except CmdError as e: print_error(e) sys.exit(1) except Exception as e: post_mortem() sys.exit(1)