| 103 | |
| 104 | |
| 105 | def command_line_args(args): |
| 106 | need_print_help = False if args else True |
| 107 | parser = parse_args() |
| 108 | args = parser.parse_args(args) |
| 109 | if args.help or need_print_help: |
| 110 | parser.print_help() |
| 111 | sys.exit(1) |
| 112 | if not args.start_file: |
| 113 | raise ValueError('Lack of parameter: start_file') |
| 114 | if args.flashback and args.stop_never: |
| 115 | raise ValueError('Only one of flashback or stop-never can be True') |
| 116 | if args.flashback and args.no_pk: |
| 117 | raise ValueError('Only one of flashback or no_pk can be True') |
| 118 | if (args.start_time and not is_valid_datetime(args.start_time)) or \ |
| 119 | (args.stop_time and not is_valid_datetime(args.stop_time)): |
| 120 | raise ValueError('Incorrect datetime argument') |
| 121 | if not args.password: |
| 122 | args.password = getpass.getpass() |
| 123 | else: |
| 124 | args.password = args.password[0] |
| 125 | return args |
| 126 | |
| 127 | |
| 128 | def compare_items(items): |