Commit 5d78a26

Anton Golub <antongolub@antongolub.com>
2024-09-14 15:48:15
feat: expose formatted cmd via getter (#891)
1 parent ae4fb3c
Changed files (2)
src/core.ts
@@ -371,6 +371,10 @@ export class ProcessPromise extends Promise<ProcessOutput> {
     return this
   }
 
+  get cmd() {
+    return this._command
+  }
+
   get child() {
     return this._zurk?.child
   }
test/core.test.js
@@ -295,6 +295,13 @@ describe('core', () => {
       assert.ok(o instanceof ProcessOutput)
     })
 
+    test('cmd() returns cmd to exec', () => {
+      const foo = '#bar'
+      const baz = 1
+      const p = $`echo ${foo} --t ${baz}`
+      assert.equal(p.cmd, "echo $'#bar' --t 1")
+    })
+
     test('stdio() works', async () => {
       let p = $`printf foo`
       await p