list all dotfiles for a specific profile
(opts)
| 576 | |
| 577 | |
| 578 | def cmd_files(opts): |
| 579 | """list all dotfiles for a specific profile""" |
| 580 | if opts.profile not in [p.key for p in opts.profiles]: |
| 581 | LOG.warn(f'unknown profile \"{opts.profile}\"') |
| 582 | return |
| 583 | what = 'Dotfile(s)' |
| 584 | if opts.files_templateonly: |
| 585 | what = 'Template(s)' |
| 586 | LOG.emph(f'{what} for profile \"{opts.profile}\":\n') |
| 587 | for dotfile in opts.dotfiles: |
| 588 | if opts.files_templateonly: |
| 589 | src = os.path.join(opts.dotpath, dotfile.src) |
| 590 | if not Templategen.path_is_template(src): |
| 591 | continue |
| 592 | if opts.files_grepable: |
| 593 | fmt = f'{dotfile.key},' |
| 594 | fmt += f'dst:{dotfile.dst},' |
| 595 | fmt += f'src:{dotfile.src},' |
| 596 | fmt += f'link:{dotfile.link.name.lower()}' |
| 597 | if dotfile.chmod: |
| 598 | fmt += f',chmod:{dotfile.chmod:o}' |
| 599 | else: |
| 600 | fmt += ',chmod:None' |
| 601 | LOG.raw(fmt) |
| 602 | else: |
| 603 | LOG.log(f'{dotfile.key}', bold=True) |
| 604 | LOG.sub(f'dst: {dotfile.dst}') |
| 605 | LOG.sub(f'src: {dotfile.src}') |
| 606 | LOG.sub(f'link: {dotfile.link.name.lower()}') |
| 607 | if dotfile.chmod: |
| 608 | LOG.sub(f'chmod: {dotfile.chmod:o}') |
| 609 | LOG.log('') |
| 610 | |
| 611 | |
| 612 | def cmd_detail(opts): |