MCPcopy
hub / github.com/deadc0de6/dotdrop / cmd_files

Function cmd_files

dotdrop/dotdrop.py:578–609  ·  view source on GitHub ↗

list all dotfiles for a specific profile

(opts)

Source from the content-addressed store, hash-verified

576
577
578def 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
612def cmd_detail(opts):

Callers 3

test_listingsMethod · 0.90
test_importMethod · 0.90
_exec_commandFunction · 0.85

Calls 6

warnMethod · 0.80
emphMethod · 0.80
path_is_templateMethod · 0.80
rawMethod · 0.80
logMethod · 0.80
subMethod · 0.80

Tested by 2

test_listingsMethod · 0.72
test_importMethod · 0.72