From cced3d12c9b90e2258158a7f0a4c08c42e084368 Mon Sep 17 00:00:00 2001
From: Martin Craig <martin.craig@eng.ox.ac.uk>
Date: Mon, 24 Feb 2020 11:22:33 +0000
Subject: [PATCH] Rename input parameter and add return docstring

---
 fsl/utils/run.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fsl/utils/run.py b/fsl/utils/run.py
index 46b19f39d..6d4b33ee3 100644
--- a/fsl/utils/run.py
+++ b/fsl/utils/run.py
@@ -398,16 +398,18 @@ def wslpath(patharg):
     Convert a command line argument containing a Windows path to the equivalent WSL path (e.g. ``c:\\Users`` -> ``/mnt/c/Users``) 
     
     :param patharg: Command line argument which may (or may not) contain a Windows path. It is assumed to be 
-                    either of the form <windows path> or --arg=<windows path>
+                    either of the form <windows path> or --<arg>=<windows path>
+    :return: If ``patharg`` matches a Windows path, the converted argument (including the --<arg>= portion). Otherwise
+             returns ``patharg`` unchanged.
     """
-    match = re.match("^(--[\w-]+=)?([a-zA-z]):(.+)$", path)
+    match = re.match("^(--[\w-]+=)?([a-zA-z]):(.+)$", patharg)
     if match:
         arg, drive, path = match.group(1, 2, 3)
         if arg is None:
             arg = ""
         return arg + "/mnt/" + drive.lower() + path.replace("\\", "/") 
     else:
-        return path
+        return patharg
 
 def wait(job_ids):
     """Proxy for :func:`.fslsub.wait`. """
-- 
GitLab