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

Function cmd_importer

dotdrop/dotdrop.py:529–562  ·  view source on GitHub ↗

import dotfile(s) from paths

(opts)

Source from the content-addressed store, hash-verified

527
528
529def cmd_importer(opts):
530 """import dotfile(s) from paths"""
531 ret = True
532 cnt = 0
533 paths = opts.import_path
534 importer = Importer(opts.profile, opts.conf,
535 opts.dotpath, opts.diff_command,
536 opts.variables,
537 dry=opts.dry, safe=opts.safe,
538 debug=opts.debug,
539 keepdot=opts.keepdot,
540 ignore=opts.import_ignore,
541 forcekey=opts.import_force_key)
542
543 for path in paths:
544 tmpret = importer.import_path(path,
545 import_as=opts.import_as,
546 import_link=opts.import_link,
547 import_mode=opts.import_mode,
548 trans_install=opts.import_trans_install,
549 trans_update=opts.import_trans_update)
550 if tmpret < 0:
551 ret = False
552 elif tmpret > 0:
553 cnt += 1
554
555 if opts.dry:
556 LOG.dry('new config file would be:')
557 LOG.raw(opts.conf.dump())
558 else:
559 opts.conf.save()
560 LOG.log(f'\n{cnt} file(s) imported.')
561
562 return ret
563
564
565def cmd_list_profiles(opts):

Callers 6

test_updateMethod · 0.90
test_listingsMethod · 0.90
test_compareMethod · 0.90
test_importMethod · 0.90
_exec_commandFunction · 0.85

Calls 7

import_pathMethod · 0.95
ImporterClass · 0.90
dryMethod · 0.80
rawMethod · 0.80
logMethod · 0.80
dumpMethod · 0.45
saveMethod · 0.45

Tested by 5

test_updateMethod · 0.72
test_listingsMethod · 0.72
test_compareMethod · 0.72
test_importMethod · 0.72