aboutsummaryrefslogtreecommitdiff
path: root/delivery_merge/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'delivery_merge/utils.py')
-rw-r--r--delivery_merge/utils.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/delivery_merge/utils.py b/delivery_merge/utils.py
index 2f23e0e..705eaf2 100644
--- a/delivery_merge/utils.py
+++ b/delivery_merge/utils.py
@@ -3,6 +3,21 @@ from contextlib import contextmanager
from subprocess import run
+def comment_find(s, delims=[';', '#']):
+ """ Find the first occurence of a comment in a string
+
+ :param s: string
+ :param delims: list: of comment delimiters
+ :returns: integer: index of first match
+ """
+ for delim in delims:
+ index = s.find(delim)
+ if index != -1:
+ break
+
+ return index
+
+
def sh(prog, *args):
""" Execute a program with arguments
:param prog: str: path to program