Utilities¶
- modify_repos.utils.run_cmd(*args, **kwargs)¶
Wrapper around
subprocess.run(). Args are passed positionally rather than as a list. Stdout and stderr are combined, and use text mode. The initial command is echoed, and if the return code is not 0, the output and code are echoed.
- modify_repos.utils.wrap_text(text, width=80)¶
Wrap a multi-line, multi-paragraph string. The text is dedented and empty spaces and lines are stripped, to support triple-quoted strings. Paragraphs are separated by a blank line
\n\n. Tabs are converted to 4 spaces, and very long words are not wrapped.
- modify_repos.utils.read_text(path, strip=True)¶
Read a file as UTF-8 text.
- modify_repos.utils.write_text(path, text, end_nl=True)¶
Write a file as UTF-8 text.