aboutsummaryrefslogtreecommitdiff
path: root/delivery_merge
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2019-05-11 00:40:29 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2019-05-11 00:40:29 -0400
commit8cdfaacd3c1cf4a1ecb15562934086a5b89a888b (patch)
treebac42930a6407b064f76f18c57399a89bf370bb6 /delivery_merge
parentc3e27b17abc58e0b64d8863faa3e91a88f810d6e (diff)
downloaddelivery_merge-8cdfaacd3c1cf4a1ecb15562934086a5b89a888b.tar.gz
Move comment_find in
Diffstat (limited to 'delivery_merge')
-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