convert an array of paths to cli compatible list of paths, suitable for setting as an environment variable.
import { assertEquals } from "jsr:@std/assert"// aliasing our functions for brevityconst eq = assertEquals, fn = pathsToCliArg// conversion example with windows separator (";")eq(fn(";", [ "./a/b/c.txt", "C:\\Android Studio\\sdk\\", "build\\libs\\"]), `"./a/b/c.txt;C:/Android Studio/sdk/;build/libs/"`)// conversion example with unix separator (":")eq(fn(":", [ "./a/b/c.txt", "~/Android Studio/sdk/", "build/libs/"]), `"./a/b/c.txt:~/Android Studio/sdk/:build/libs/"`) Copy
import { assertEquals } from "jsr:@std/assert"// aliasing our functions for brevityconst eq = assertEquals, fn = pathsToCliArg// conversion example with windows separator (";")eq(fn(";", [ "./a/b/c.txt", "C:\\Android Studio\\sdk\\", "build\\libs\\"]), `"./a/b/c.txt;C:/Android Studio/sdk/;build/libs/"`)// conversion example with unix separator (":")eq(fn(":", [ "./a/b/c.txt", "~/Android Studio/sdk/", "build/libs/"]), `"./a/b/c.txt:~/Android Studio/sdk/:build/libs/"`)
convert an array of paths to cli compatible list of paths, suitable for setting as an environment variable.
Example