()
| 68 | |
| 69 | |
| 70 | def main(): |
| 71 | opt = parse_cmdline() |
| 72 | logger.info("reading %s", opt.file) |
| 73 | yaml = YAML(typ="rt") |
| 74 | filedata = yaml.load(opt.file) |
| 75 | |
| 76 | for username in opt.add or (): |
| 77 | add_entry(opt, filedata, username) |
| 78 | |
| 79 | for username in opt.update or (): |
| 80 | update_entry(opt, filedata, username) |
| 81 | |
| 82 | if opt.update_all: |
| 83 | for entry in filedata: |
| 84 | update_entry(opt, filedata, entry) |
| 85 | |
| 86 | # yamllint happy |
| 87 | yaml.explicit_start = True |
| 88 | logger.info("writing %s", opt.file) |
| 89 | yaml.dump(filedata, opt.file) |
| 90 | |
| 91 | |
| 92 | def parse_cmdline(): |
no test coverage detected