@@ 385-409 (lines=25) @@ | ||
382 | # sub parser process operation |
|
383 | # |
|
384 | ############################################ |
|
385 | def merge_yaml(_args): |
|
386 | _dict = _args.__dict__ |
|
387 | ||
388 | _m_file = _dict.get("merge_file", None) |
|
389 | _in_file, _u, _a, _i, _o, _tips = _get_update_par(_args) |
|
390 | ||
391 | if not (_in_file and _m_file): |
|
392 | print(_tips) |
|
393 | sys.exit(1) |
|
394 | ||
395 | code = _load(_in_file) |
|
396 | mcode = _load(_m_file) |
|
397 | ||
398 | _merge(code, mcode) |
|
399 | ||
400 | _update(code, _u, _a, _tips) |
|
401 | ||
402 | if _i: |
|
403 | _backup(_in_file) |
|
404 | _save(code, _in_file) |
|
405 | elif _o: |
|
406 | _save(code, _o) |
|
407 | else: |
|
408 | print(_tips) |
|
409 | sys.exit(1) |
|
410 | ||
411 | ||
412 | def update_yaml(_args): |
@@ 385-409 (lines=25) @@ | ||
382 | # sub parser process operation |
|
383 | # |
|
384 | ############################################ |
|
385 | def merge_yaml(_args): |
|
386 | _dict = _args.__dict__ |
|
387 | ||
388 | _m_file = _dict.get("merge_file", None) |
|
389 | _in_file, _u, _a, _i, _o, _tips = _get_update_par(_args) |
|
390 | ||
391 | if not (_in_file and _m_file): |
|
392 | print(_tips) |
|
393 | sys.exit(1) |
|
394 | ||
395 | code = _load(_in_file) |
|
396 | mcode = _load(_m_file) |
|
397 | ||
398 | _merge(code, mcode) |
|
399 | ||
400 | _update(code, _u, _a, _tips) |
|
401 | ||
402 | if _i: |
|
403 | _backup(_in_file) |
|
404 | _save(code, _in_file) |
|
405 | elif _o: |
|
406 | _save(code, _o) |
|
407 | else: |
|
408 | print(_tips) |
|
409 | sys.exit(1) |
|
410 | ||
411 | ||
412 | def update_yaml(_args): |