just-bash 1.2.5 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/README.md +1 -1
  2. package/dist/ai/index.d.ts +5 -0
  3. package/dist/bin/chunks/alias-ZAQAKC5X.js +7 -0
  4. package/dist/bin/chunks/awk2-A73ZNFXJ.js +20 -0
  5. package/dist/bin/chunks/base64-JPITV4MD.js +6 -0
  6. package/dist/bin/chunks/base64-KNBBHA5Y.js +5 -0
  7. package/dist/bin/chunks/basename-IYEP3AMY.js +6 -0
  8. package/dist/bin/chunks/bash-WZYHIZP6.js +7 -0
  9. package/dist/bin/chunks/cat-XILYL7NW.js +6 -0
  10. package/dist/bin/chunks/chmod-EXWX4N7Y.js +9 -0
  11. package/dist/bin/chunks/chunk-7Q4WQLOS.js +9 -0
  12. package/dist/bin/chunks/chunk-GX4MPCG6.js +9 -0
  13. package/dist/bin/chunks/chunk-SJXDWN5X.js +2 -0
  14. package/dist/bin/chunks/clear-2APRIRCF.js +2 -0
  15. package/dist/bin/chunks/comm-KY3COLF5.js +13 -0
  16. package/dist/bin/chunks/cp-HES4UN7K.js +8 -0
  17. package/dist/bin/chunks/curl-BN5M3BUX.js +26 -0
  18. package/dist/bin/chunks/cut-JSIPAKOX.js +6 -0
  19. package/dist/bin/chunks/date-CU4J7GHI.js +5 -0
  20. package/dist/bin/chunks/diff-W4JRNHXW.js +19 -0
  21. package/dist/bin/chunks/dirname-UTCUUILN.js +5 -0
  22. package/dist/bin/chunks/du-2JU3PUTM.js +8 -0
  23. package/dist/bin/chunks/echo-HKLPYMNC.js +4 -0
  24. package/dist/bin/chunks/env-2SBJNP7X.js +9 -0
  25. package/dist/bin/chunks/expr-M74QZQ6C.js +5 -0
  26. package/dist/bin/chunks/file-Q4UOC4J2.js +23 -0
  27. package/dist/bin/chunks/file-QPD3U2H7.js +23 -0
  28. package/dist/bin/chunks/find-D3ZC5DXH.js +11 -0
  29. package/dist/bin/chunks/grep-BEZRXAWL.js +15 -0
  30. package/dist/bin/chunks/head-YGMY3DHE.js +2 -0
  31. package/dist/bin/chunks/help-UEF7LW7F.js +16 -0
  32. package/dist/bin/chunks/history-OGBCIAR5.js +3 -0
  33. package/dist/bin/chunks/html-to-markdown-HTGML4TH.js +84 -0
  34. package/dist/bin/chunks/jq-ME57VHK6.js +14 -0
  35. package/dist/bin/chunks/ln-RUR4ALOJ.js +10 -0
  36. package/dist/bin/chunks/ls-GU5227KE.js +26 -0
  37. package/dist/bin/chunks/md5sum-C7WDEYN5.js +2 -0
  38. package/dist/bin/chunks/md5sum-KZ4MRIXM.js +2 -0
  39. package/dist/bin/chunks/mkdir-4OYU22AA.js +7 -0
  40. package/dist/bin/chunks/mv-H3S4FEWR.js +7 -0
  41. package/dist/bin/chunks/paste-HHCFASL4.js +8 -0
  42. package/dist/bin/chunks/printf-2JFCUFOA.js +14 -0
  43. package/dist/bin/chunks/pwd-T5Q3JEBO.js +3 -0
  44. package/dist/bin/chunks/readlink-M44TLMFS.js +7 -0
  45. package/dist/bin/chunks/rm-R4M647EC.js +8 -0
  46. package/dist/bin/chunks/sed-QLLAZYHH.js +80 -0
  47. package/dist/bin/chunks/seq-GJMQM7SP.js +7 -0
  48. package/dist/bin/chunks/sha1sum-WKCGV66X.js +2 -0
  49. package/dist/bin/chunks/sha1sum-XLRE72T4.js +2 -0
  50. package/dist/bin/chunks/sha256sum-3ZDGP5WC.js +2 -0
  51. package/dist/bin/chunks/sha256sum-BBKWFA43.js +2 -0
  52. package/dist/bin/chunks/sleep-OJPODQGM.js +10 -0
  53. package/dist/bin/chunks/sort-JL33INQB.js +16 -0
  54. package/dist/bin/chunks/sort-NCQNGVCX.js +16 -0
  55. package/dist/bin/chunks/sort-WGKQ3WYR.js +15 -0
  56. package/dist/bin/chunks/stat-CR2INBC2.js +9 -0
  57. package/dist/bin/chunks/tail-BYPLMYMZ.js +2 -0
  58. package/dist/bin/chunks/tee-HOMRRC3X.js +3 -0
  59. package/dist/bin/chunks/timeout-MYKG34DQ.js +12 -0
  60. package/dist/bin/chunks/touch-3ZANYAXI.js +4 -0
  61. package/dist/bin/chunks/tr-E66N7IS2.js +20 -0
  62. package/dist/bin/chunks/tree-EE2PYIMV.js +12 -0
  63. package/dist/bin/chunks/true-OWPVS7U4.js +2 -0
  64. package/dist/bin/chunks/uniq-F5NP3LLU.js +5 -0
  65. package/dist/bin/chunks/wc-NBMNJDZL.js +6 -0
  66. package/dist/bin/chunks/which-6MRG2UCF.js +3 -0
  67. package/dist/bin/chunks/xargs-EMY5BOJ2.js +4 -0
  68. package/dist/bin/chunks/xargs-XAZFX5J3.js +4 -0
  69. package/dist/bin/just-bash.js +36 -36
  70. package/dist/bin/shell/chunks/alias-ZAQAKC5X.js +7 -0
  71. package/dist/bin/shell/chunks/awk2-A73ZNFXJ.js +20 -0
  72. package/dist/bin/shell/chunks/base64-JPITV4MD.js +6 -0
  73. package/dist/bin/shell/chunks/base64-KNBBHA5Y.js +5 -0
  74. package/dist/bin/shell/chunks/basename-IYEP3AMY.js +6 -0
  75. package/dist/bin/shell/chunks/bash-WZYHIZP6.js +7 -0
  76. package/dist/bin/shell/chunks/cat-XILYL7NW.js +6 -0
  77. package/dist/bin/shell/chunks/chmod-EXWX4N7Y.js +9 -0
  78. package/dist/bin/shell/chunks/chunk-7Q4WQLOS.js +9 -0
  79. package/dist/bin/shell/chunks/chunk-GX4MPCG6.js +9 -0
  80. package/dist/bin/shell/chunks/chunk-SJXDWN5X.js +2 -0
  81. package/dist/bin/shell/chunks/clear-2APRIRCF.js +2 -0
  82. package/dist/bin/shell/chunks/comm-KY3COLF5.js +13 -0
  83. package/dist/bin/shell/chunks/cp-HES4UN7K.js +8 -0
  84. package/dist/bin/shell/chunks/curl-BN5M3BUX.js +26 -0
  85. package/dist/bin/shell/chunks/cut-JSIPAKOX.js +6 -0
  86. package/dist/bin/shell/chunks/date-CU4J7GHI.js +5 -0
  87. package/dist/bin/shell/chunks/diff-W4JRNHXW.js +19 -0
  88. package/dist/bin/shell/chunks/dirname-UTCUUILN.js +5 -0
  89. package/dist/bin/shell/chunks/du-2JU3PUTM.js +8 -0
  90. package/dist/bin/shell/chunks/echo-HKLPYMNC.js +4 -0
  91. package/dist/bin/shell/chunks/env-2SBJNP7X.js +9 -0
  92. package/dist/bin/shell/chunks/expr-M74QZQ6C.js +5 -0
  93. package/dist/bin/shell/chunks/file-Q4UOC4J2.js +23 -0
  94. package/dist/bin/shell/chunks/file-QPD3U2H7.js +23 -0
  95. package/dist/bin/shell/chunks/find-D3ZC5DXH.js +11 -0
  96. package/dist/bin/shell/chunks/grep-BEZRXAWL.js +15 -0
  97. package/dist/bin/shell/chunks/head-YGMY3DHE.js +2 -0
  98. package/dist/bin/shell/chunks/help-UEF7LW7F.js +16 -0
  99. package/dist/bin/shell/chunks/history-OGBCIAR5.js +3 -0
  100. package/dist/bin/shell/chunks/html-to-markdown-HTGML4TH.js +84 -0
  101. package/dist/bin/shell/chunks/jq-ME57VHK6.js +14 -0
  102. package/dist/bin/shell/chunks/ln-RUR4ALOJ.js +10 -0
  103. package/dist/bin/shell/chunks/ls-GU5227KE.js +26 -0
  104. package/dist/bin/shell/chunks/md5sum-C7WDEYN5.js +2 -0
  105. package/dist/bin/shell/chunks/md5sum-KZ4MRIXM.js +2 -0
  106. package/dist/bin/shell/chunks/mkdir-4OYU22AA.js +7 -0
  107. package/dist/bin/shell/chunks/mv-H3S4FEWR.js +7 -0
  108. package/dist/bin/shell/chunks/paste-HHCFASL4.js +8 -0
  109. package/dist/bin/shell/chunks/printf-2JFCUFOA.js +14 -0
  110. package/dist/bin/shell/chunks/pwd-T5Q3JEBO.js +3 -0
  111. package/dist/bin/shell/chunks/readlink-M44TLMFS.js +7 -0
  112. package/dist/bin/shell/chunks/rm-R4M647EC.js +8 -0
  113. package/dist/bin/shell/chunks/sed-QLLAZYHH.js +80 -0
  114. package/dist/bin/shell/chunks/seq-GJMQM7SP.js +7 -0
  115. package/dist/bin/shell/chunks/sha1sum-WKCGV66X.js +2 -0
  116. package/dist/bin/shell/chunks/sha1sum-XLRE72T4.js +2 -0
  117. package/dist/bin/shell/chunks/sha256sum-3ZDGP5WC.js +2 -0
  118. package/dist/bin/shell/chunks/sha256sum-BBKWFA43.js +2 -0
  119. package/dist/bin/shell/chunks/sleep-OJPODQGM.js +10 -0
  120. package/dist/bin/shell/chunks/sort-JL33INQB.js +16 -0
  121. package/dist/bin/shell/chunks/sort-NCQNGVCX.js +16 -0
  122. package/dist/bin/shell/chunks/sort-WGKQ3WYR.js +15 -0
  123. package/dist/bin/shell/chunks/stat-CR2INBC2.js +9 -0
  124. package/dist/bin/shell/chunks/tail-BYPLMYMZ.js +2 -0
  125. package/dist/bin/shell/chunks/tee-HOMRRC3X.js +3 -0
  126. package/dist/bin/shell/chunks/timeout-MYKG34DQ.js +12 -0
  127. package/dist/bin/shell/chunks/touch-3ZANYAXI.js +4 -0
  128. package/dist/bin/shell/chunks/tr-E66N7IS2.js +20 -0
  129. package/dist/bin/shell/chunks/tree-EE2PYIMV.js +12 -0
  130. package/dist/bin/shell/chunks/true-OWPVS7U4.js +2 -0
  131. package/dist/bin/shell/chunks/uniq-F5NP3LLU.js +5 -0
  132. package/dist/bin/shell/chunks/wc-NBMNJDZL.js +6 -0
  133. package/dist/bin/shell/chunks/which-6MRG2UCF.js +3 -0
  134. package/dist/bin/shell/chunks/xargs-EMY5BOJ2.js +4 -0
  135. package/dist/bin/shell/chunks/xargs-XAZFX5J3.js +4 -0
  136. package/dist/bin/shell/shell.js +1 -1
  137. package/dist/bundle/ai/index.js +384 -343
  138. package/dist/bundle/chunks/alias-JFIUWFGE.js +6 -0
  139. package/dist/bundle/chunks/awk2-QWBT4IFJ.js +19 -0
  140. package/dist/bundle/chunks/base64-JN6XXTIG.js +4 -0
  141. package/dist/bundle/chunks/base64-TUA2XORD.js +5 -0
  142. package/dist/bundle/chunks/basename-5UVU5RXR.js +5 -0
  143. package/dist/bundle/chunks/bash-BASUPKHJ.js +6 -0
  144. package/dist/bundle/chunks/cat-47EP4IAV.js +5 -0
  145. package/dist/bundle/chunks/chmod-XJXFAD4M.js +8 -0
  146. package/dist/bundle/chunks/chunk-2RUN43TJ.js +1 -0
  147. package/dist/bundle/chunks/chunk-46TSKXFW.js +8 -0
  148. package/dist/bundle/chunks/chunk-4HEWHW5W.js +8 -0
  149. package/dist/bundle/chunks/clear-XD3TJRVQ.js +1 -0
  150. package/dist/bundle/chunks/comm-KSJ4BBRQ.js +12 -0
  151. package/dist/bundle/chunks/cp-37OVLNLD.js +7 -0
  152. package/dist/bundle/chunks/curl-C43O5WQS.js +25 -0
  153. package/dist/bundle/chunks/cut-FIZRELKC.js +5 -0
  154. package/dist/bundle/chunks/date-NN5C354M.js +4 -0
  155. package/dist/bundle/chunks/diff-GLRVCAKJ.js +6 -0
  156. package/dist/bundle/chunks/dirname-U2KVUSQY.js +4 -0
  157. package/dist/bundle/chunks/du-KRAFOIQK.js +7 -0
  158. package/dist/bundle/chunks/echo-WUKBESC7.js +3 -0
  159. package/dist/bundle/chunks/env-MSPSPGCD.js +8 -0
  160. package/dist/bundle/chunks/expr-HYOCSWK6.js +4 -0
  161. package/dist/bundle/chunks/file-JMDIXLHY.js +22 -0
  162. package/dist/bundle/chunks/file-LQXX6P4Y.js +22 -0
  163. package/dist/bundle/chunks/find-R6LJIRBI.js +10 -0
  164. package/dist/bundle/chunks/grep-ZJVDG3FA.js +14 -0
  165. package/dist/bundle/chunks/head-6PAUYCDP.js +1 -0
  166. package/dist/bundle/chunks/help-5E6PYJWQ.js +15 -0
  167. package/dist/bundle/chunks/history-SG6VRATI.js +2 -0
  168. package/dist/bundle/chunks/html-to-markdown-ZSZ34PAN.js +4 -0
  169. package/dist/bundle/chunks/jq-ABWUP4LV.js +13 -0
  170. package/dist/bundle/chunks/ln-XFYHBIFL.js +9 -0
  171. package/dist/bundle/chunks/ls-JGYJQA2Y.js +23 -0
  172. package/dist/bundle/chunks/md5sum-3BXZVFKC.js +1 -0
  173. package/dist/bundle/chunks/md5sum-PIH6F3O3.js +1 -0
  174. package/dist/bundle/chunks/mkdir-HA2FJX4O.js +6 -0
  175. package/dist/bundle/chunks/mv-7I62SB3I.js +6 -0
  176. package/dist/bundle/chunks/paste-QBGVCQFT.js +7 -0
  177. package/dist/bundle/chunks/printf-HBP44PXI.js +13 -0
  178. package/dist/bundle/chunks/pwd-CEF235GL.js +2 -0
  179. package/dist/bundle/chunks/readlink-MQIMKDSA.js +6 -0
  180. package/dist/bundle/chunks/rm-NF3FNLAY.js +7 -0
  181. package/dist/bundle/chunks/sed-H2RWPMTM.js +79 -0
  182. package/dist/bundle/chunks/seq-VKYIUOPJ.js +6 -0
  183. package/dist/bundle/chunks/sha1sum-HVHNZSEC.js +1 -0
  184. package/dist/bundle/chunks/sha1sum-MSBXCB4N.js +1 -0
  185. package/dist/bundle/chunks/sha256sum-REOOJORK.js +1 -0
  186. package/dist/bundle/chunks/sha256sum-YMKJMSTW.js +1 -0
  187. package/dist/bundle/chunks/sleep-AFN3PHJW.js +9 -0
  188. package/dist/bundle/chunks/sort-R3YWDMTV.js +14 -0
  189. package/dist/bundle/chunks/sort-TEXV7CUR.js +15 -0
  190. package/dist/bundle/chunks/sort-XODGFZC4.js +15 -0
  191. package/dist/bundle/chunks/stat-FVFLDQGP.js +8 -0
  192. package/dist/bundle/chunks/tail-QXKYHAML.js +1 -0
  193. package/dist/bundle/chunks/tee-W5HCCBPO.js +2 -0
  194. package/dist/bundle/chunks/timeout-XAA3N7CF.js +11 -0
  195. package/dist/bundle/chunks/touch-FOE745V2.js +3 -0
  196. package/dist/bundle/chunks/tr-LMLGE4IE.js +19 -0
  197. package/dist/bundle/chunks/tree-WBUGLVP5.js +11 -0
  198. package/dist/bundle/chunks/true-6LGCG4EY.js +1 -0
  199. package/dist/bundle/chunks/uniq-7PFWPNWK.js +4 -0
  200. package/dist/bundle/chunks/wc-GV5WUREX.js +5 -0
  201. package/dist/bundle/chunks/which-KHFYPBWW.js +2 -0
  202. package/dist/bundle/chunks/xargs-7KV5F66T.js +3 -0
  203. package/dist/bundle/chunks/xargs-NQBNFMCT.js +3 -0
  204. package/dist/bundle/index.js +1 -1
  205. package/dist/commands/comm/comm.d.ts +10 -0
  206. package/dist/commands/file/file.d.ts +7 -0
  207. package/dist/commands/md5sum/checksum.d.ts +7 -0
  208. package/dist/commands/md5sum/md5sum.d.ts +2 -0
  209. package/dist/commands/md5sum/sha1sum.d.ts +2 -0
  210. package/dist/commands/md5sum/sha256sum.d.ts +2 -0
  211. package/dist/commands/registry.d.ts +1 -1
  212. package/dist/commands/sort/types.d.ts +12 -0
  213. package/package.json +2 -1
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import{a as c,b as f,c as u}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var x={name:"timeout",summary:"run a command with a time limit",usage:"timeout [OPTION] DURATION COMMAND [ARG]...",description:`Start COMMAND, and kill it if still running after DURATION.
3
+
4
+ DURATION is a number with optional suffix:
5
+ s - seconds (default)
6
+ m - minutes
7
+ h - hours
8
+ d - days`,options:["-k, --kill-after=DURATION send KILL signal after DURATION if still running","-s, --signal=SIGNAL specify signal to send (default: TERM)"," --preserve-status exit with same status as COMMAND, even on timeout"," --foreground run command in foreground"," --help display this help and exit"]};function O(r){let i=r.match(/^(\d+\.?\d*)(s|m|h|d)?$/);if(!i)return null;let n=parseFloat(i[1]);switch(i[2]||"s"){case"s":return n*1e3;case"m":return n*60*1e3;case"h":return n*60*60*1e3;case"d":return n*24*60*60*1e3;default:return null}}var w={name:"timeout",async execute(r,i){if(f(r))return c(x);let n=!1,s=0;for(let t=0;t<r.length;t++){let e=r[t];if(e==="--preserve-status")n=!0,s=t+1;else if(e==="--foreground")s=t+1;else if(e==="-k"||e==="--kill-after")t++,s=t+1;else if(e.startsWith("--kill-after="))s=t+1;else if(e==="-s"||e==="--signal")t++,s=t+1;else if(e.startsWith("--signal="))s=t+1;else{if(e.startsWith("--")&&e!=="--")return u("timeout",e);if(e.startsWith("-")&&e.length>1&&e!=="--")if(e.startsWith("-k"))s=t+1;else if(e.startsWith("-s"))s=t+1;else return u("timeout",e);else{s=t;break}}}let o=r.slice(s);if(o.length===0)return{stdout:"",stderr:`timeout: missing operand
9
+ `,exitCode:1};let a=o[0],l=O(a);if(l===null)return{stdout:"",stderr:`timeout: invalid time interval '${a}'
10
+ `,exitCode:1};let m=o.slice(1);if(m.length===0)return{stdout:"",stderr:`timeout: missing operand
11
+ `,exitCode:1};if(!i.exec)return{stdout:"",stderr:`timeout: exec not available
12
+ `,exitCode:1};let h=m.map(t=>t.includes(" ")||t.includes(" ")?`'${t.replace(/'/g,"'\\''")}'`:t).join(" "),p=new Promise(t=>{setTimeout(()=>t({timedOut:!0}),l)}),g=i.exec(h,{cwd:i.cwd}).then(t=>({timedOut:!1,result:t})),d=await Promise.race([p,g]);return d.timedOut?{stdout:"",stderr:"",exitCode:124}:d.result}};export{w as timeoutCommand};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{a as f}from"./chunk-4VDEBYW7.js";import{c as r}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var l={name:"touch",async execute(u,e){let s=[];for(let t of u){if(t.startsWith("--"))return r("touch",t);if(t.startsWith("-")&&t.length>1)return r("touch",t);s.push(t)}if(s.length===0)return{stdout:"",stderr:`touch: missing file operand
3
+ `,exitCode:1};let n="",i=0;for(let t of s)try{let o=e.fs.resolvePath(e.cwd,t);await e.fs.exists(o)||await e.fs.writeFile(o,"")}catch(o){n+=`touch: cannot touch '${t}': ${f(o)}
4
+ `,i=1}return{stdout:"",stderr:n,exitCode:i}}};export{l as touchCommand};
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ import{a as C}from"./chunk-TA7RUHGQ.js";import{a as g,b as m}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var x={name:"tr",summary:"translate or delete characters",usage:"tr [OPTION]... SET1 [SET2]",options:["-c, -C, --complement use the complement of SET1","-d, --delete delete characters in SET1","-s, --squeeze-repeats squeeze repeated characters"," --help display this help and exit"],description:`SET syntax:
3
+ a-z character range
4
+ [:alnum:] all letters and digits
5
+ [:alpha:] all letters
6
+ [:digit:] all digits
7
+ [:lower:] all lowercase letters
8
+ [:upper:] all uppercase letters
9
+ [:space:] all whitespace
10
+ [:blank:] horizontal whitespace
11
+ [:punct:] all punctuation
12
+ [:print:] all printable characters
13
+ [:graph:] all printable characters except space
14
+ [:cntrl:] all control characters
15
+ [:xdigit:] all hexadecimal digits
16
+ \\n, \\t, \\r escape sequences`},b={"[:alnum:]":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789","[:alpha:]":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz","[:blank:]":" ","[:cntrl:]":Array.from({length:32},(r,n)=>String.fromCharCode(n)).join("").concat("\x7F"),"[:digit:]":"0123456789","[:graph:]":Array.from({length:94},(r,n)=>String.fromCharCode(33+n)).join(""),"[:lower:]":"abcdefghijklmnopqrstuvwxyz","[:print:]":Array.from({length:95},(r,n)=>String.fromCharCode(32+n)).join(""),"[:punct:]":"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~","[:space:]":`
17
+ \r\f\v`,"[:upper:]":"ABCDEFGHIJKLMNOPQRSTUVWXYZ","[:xdigit:]":"0123456789ABCDEFabcdef"};function S(r){let n="",e=0;for(;e<r.length;){if(r[e]==="["&&r[e+1]===":"){let l=!1;for(let[i,a]of Object.entries(b))if(r.slice(e).startsWith(i)){n+=a,e+=i.length,l=!0;break}if(l)continue}if(r[e]==="\\"&&e+1<r.length){let l=r[e+1];l==="n"?n+=`
18
+ `:l==="t"?n+=" ":l==="r"?n+="\r":n+=l,e+=2;continue}if(e+2<r.length&&r[e+1]==="-"){let l=r.charCodeAt(e),i=r.charCodeAt(e+2);for(let a=l;a<=i;a++)n+=String.fromCharCode(a);e+=3;continue}n+=r[e],e++}return n}var y={complement:{short:"c",long:"complement",type:"boolean"},complementUpper:{short:"C",type:"boolean"},delete:{short:"d",long:"delete",type:"boolean"},squeeze:{short:"s",long:"squeeze-repeats",type:"boolean"}},q={name:"tr",async execute(r,n){if(m(r))return g(x);let e=C("tr",r,y);if(!e.ok)return e.error;let l=e.result.flags.complement||e.result.flags.complementUpper,i=e.result.flags.delete,a=e.result.flags.squeeze,p=e.result.positional;if(p.length<1)return{stdout:"",stderr:`tr: missing operand
19
+ `,exitCode:1};if(!i&&!a&&p.length<2)return{stdout:"",stderr:`tr: missing operand after SET1
20
+ `,exitCode:1};let f=S(p[0]),s=p.length>1?S(p[1]):"",d=n.stdin,u=o=>{let t=f.includes(o);return l?!t:t},c="";if(i)for(let o of d)u(o)||(c+=o);else if(a&&p.length===1){let o="";for(let t of d)u(t)&&t===o||(c+=t,o=t)}else{if(l){let o=s.length>0?s[s.length-1]:"";for(let t of d)f.includes(t)?c+=t:c+=o}else{let o=new Map;for(let t=0;t<f.length;t++){let h=t<s.length?s[t]:s[s.length-1];o.set(f[t],h)}for(let t of d)c+=o.get(t)??t}if(a){let o="",t="";for(let h of c)s.includes(h)&&h===t||(o+=h,t=h);c=o}}return{stdout:c,stderr:"",exitCode:0}}};export{q as trCommand};
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import{a as P}from"./chunk-TA7RUHGQ.js";import{a as $,b as w}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var g={name:"tree",summary:"list contents of directories in a tree-like format",usage:"tree [OPTION]... [DIRECTORY]...",options:["-a include hidden files","-d list directories only","-L LEVEL limit depth of directory tree","-f print full path prefix for each file"," --help display this help and exit"]},O={showHidden:{short:"a",type:"boolean"},directoriesOnly:{short:"d",type:"boolean"},fullPath:{short:"f",type:"boolean"},maxDepth:{short:"L",type:"number"}},N={name:"tree",async execute(s,o){if(w(s))return $(g);let e=P("tree",s,O);if(!e.ok)return e.error;let u={showHidden:e.result.flags.showHidden,directoriesOnly:e.result.flags.directoriesOnly,maxDepth:e.result.flags.maxDepth??null,fullPath:e.result.flags.fullPath},a=e.result.positional;a.length===0&&a.push(".");let t="",c="",l=0,r=0;for(let i of a){let n=await b(o,i,u,"",0);t+=n.output,c+=n.stderr,l+=n.dirCount,r+=n.fileCount}return t+=`
3
+ ${l} director${l===1?"y":"ies"}`,u.directoriesOnly||(t+=`, ${r} file${r===1?"":"s"}`),t+=`
4
+ `,{stdout:t,stderr:c,exitCode:c?1:0}}};async function b(s,o,e,u,a){let t={output:"",stderr:"",dirCount:0,fileCount:0},c=s.fs.resolvePath(s.cwd,o);try{if(!(await s.fs.stat(c)).isDirectory)return t.output=`${o}
5
+ `,t.fileCount=1,t}catch{return t.stderr=`tree: ${o}: No such file or directory
6
+ `,t}if(t.output=`${o}
7
+ `,e.maxDepth!==null&&a>=e.maxDepth)return t;try{let r=(await s.fs.readdir(c)).filter(i=>!(!e.showHidden&&i.startsWith(".")));r.sort();for(let i=0;i<r.length;i++){let n=r[i],f=c==="/"?`/${n}`:`${c}/${n}`,h=i===r.length-1,y=h?"`-- ":"|-- ",p=u+(h?" ":"| ");try{if((await s.fs.stat(f)).isDirectory){t.dirCount++;let d=e.fullPath?f:n;if(t.output+=`${u+y+d}
8
+ `,e.maxDepth===null||a+1<e.maxDepth){let C=await D(s,f,e,p,a+1);t.output+=C.output,t.dirCount+=C.dirCount,t.fileCount+=C.fileCount}}else if(!e.directoriesOnly){t.fileCount++;let d=e.fullPath?f:n;t.output+=`${u+y+d}
9
+ `}}catch{}}}catch{t.stderr=`tree: ${o}: Permission denied
10
+ `}return t}async function D(s,o,e,u,a){let t={output:"",stderr:"",dirCount:0,fileCount:0};if(e.maxDepth!==null&&a>=e.maxDepth)return t;try{let l=(await s.fs.readdir(o)).filter(r=>!(!e.showHidden&&r.startsWith(".")));l.sort();for(let r=0;r<l.length;r++){let i=l[r],n=o==="/"?`/${i}`:`${o}/${i}`,f=r===l.length-1,h=f?"`-- ":"|-- ",y=u+(f?" ":"| ");try{if((await s.fs.stat(n)).isDirectory){t.dirCount++;let m=e.fullPath?n:i;t.output+=`${u+h+m}
11
+ `;let d=await D(s,n,e,y,a+1);t.output+=d.output,t.dirCount+=d.dirCount,t.fileCount+=d.fileCount}else if(!e.directoriesOnly){t.fileCount++;let m=e.fullPath?n:i;t.output+=`${u+h+m}
12
+ `}}catch{}}}catch{}return t}export{N as treeCommand};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import"./chunk-SJXDWN5X.js";var e={name:"true",async execute(){return{stdout:"",stderr:"",exitCode:0}}},t={name:"false",async execute(){return{stdout:"",stderr:"",exitCode:1}}};export{t as falseCommand,e as trueCommand};
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import{b as g}from"./chunk-J7MJV6WO.js";import{a as f}from"./chunk-TA7RUHGQ.js";import{a as p,b as d}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var b={name:"uniq",summary:"report or omit repeated lines",usage:"uniq [OPTION]... [INPUT [OUTPUT]]",options:["-c, --count prefix lines by the number of occurrences","-d, --repeated only print duplicate lines","-i, --ignore-case ignore case when comparing","-u, --unique only print unique lines"," --help display this help and exit"]},w={count:{short:"c",long:"count",type:"boolean"},duplicatesOnly:{short:"d",long:"repeated",type:"boolean"},uniqueOnly:{short:"u",long:"unique",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},P={name:"uniq",async execute(a,m){if(d(a))return p(b);let o=f("uniq",a,w);if(!o.ok)return o.error;let{count:h,duplicatesOnly:y,uniqueOnly:q,ignoreCase:C}=o.result.flags,O=o.result.positional,u=await g(m,O,{cmdName:"uniq"});if(!u.ok)return u.error;let n=u.content.split(`
3
+ `);if(n.length>0&&n[n.length-1]===""&&n.pop(),n.length===0)return{stdout:"",stderr:"",exitCode:0};let t=[],r=n[0],i=1,x=(e,s)=>C?e.toLowerCase()===s.toLowerCase():e===s;for(let e=1;e<n.length;e++)x(n[e],r)?i++:(t.push({line:r,count:i}),r=n[e],i=1);t.push({line:r,count:i});let l=t;y?l=t.filter(e=>e.count>1):q&&(l=t.filter(e=>e.count===1));let c="";for(let{line:e,count:s}of l)h?c+=`${String(s).padStart(4)} ${e}
4
+ `:c+=`${e}
5
+ `;return{stdout:c,stderr:"",exitCode:0}}};export{P as uniqCommand};
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import{a as y}from"./chunk-J7MJV6WO.js";import{a as g}from"./chunk-TA7RUHGQ.js";import{a as w,b as m}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var C={name:"wc",summary:"print newline, word, and byte counts for each file",usage:"wc [OPTION]... [FILE]...",options:["-c, --bytes print the byte counts","-m, --chars print the character counts","-l, --lines print the newline counts","-w, --words print the word counts"," --help display this help and exit"]},S={lines:{short:"l",long:"lines",type:"boolean"},words:{short:"w",long:"words",type:"boolean"},bytes:{short:"c",long:"bytes",type:"boolean"},chars:{short:"m",long:"chars",type:"boolean"}},L={name:"wc",async execute(n,l){if(m(n))return w(C);let r=g("wc",n,S);if(!r.ok)return r.error;let{lines:s,words:t}=r.result.flags,e=r.result.flags.bytes||r.result.flags.chars,o=r.result.positional;!s&&!t&&!e&&(s=t=e=!0);let i=await y(l,o,{cmdName:"wc",stopOnError:!1});if(o.length===0){let f=b(i.files[0].content);return{stdout:`${h(f,s,t,e,"")}
3
+ `,stderr:"",exitCode:0}}let c="",u=0,d=0,p=0;for(let{filename:f,content:x}of i.files){let a=b(x);u+=a.lines,d+=a.words,p+=a.chars,c+=`${h(a,s,t,e,f)}
4
+ `}return o.length>1&&(c+=`${h({lines:u,words:d,chars:p},s,t,e,"total")}
5
+ `),{stdout:c,stderr:i.stderr,exitCode:i.exitCode}}};function b(n){let l=n.length,r=0,s=0,t=!1;for(let e=0;e<l;e++){let o=n[e];o===`
6
+ `?(r++,t&&(s++,t=!1)):o===" "||o===" "||o==="\r"?t&&(s++,t=!1):t=!0}return t&&s++,{lines:r,words:s,chars:l}}function h(n,l,r,s,t){let e=[];l&&e.push(String(n.lines)),r&&e.push(String(n.words)),s&&e.push(String(n.chars));let o=e.join(" ");return t&&(o+=` ${t}`),o}export{L as wcCommand};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{a as u}from"./chunk-TA7RUHGQ.js";import{a as f,b as h}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var w={name:"which",summary:"locate a command",usage:"which [-as] program ...",options:["-a List all instances of executables found","-s No output, just return 0 if found, 1 if not","--help display this help and exit"]},g={showAll:{short:"a",type:"boolean"},silent:{short:"s",type:"boolean"}},A={name:"which",async execute(s,e){if(h(s))return f(w);let t=u("which",s,g);if(!t.ok)return t.error;let c=t.result.flags.showAll,p=t.result.flags.silent,o=t.result.positional;if(o.length===0)return{stdout:"",stderr:"",exitCode:1};let d=(e.env.PATH||"/bin:/usr/bin").split(":"),n="",r=!0;for(let m of o){let a=!1;for(let i of d){if(!i)continue;let l=`${i}/${m}`;if(await e.fs.exists(l)&&(a=!0,p||(n+=`${l}
3
+ `),!c))break}a||(r=!1)}return{stdout:n,stderr:"",exitCode:r?0:1}}};export{A as whichCommand};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{a as b,b as A,c as w}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var P={name:"xargs",summary:"build and execute command lines from standard input",usage:"xargs [OPTION]... [COMMAND [INITIAL-ARGS]]",options:["-I REPLACE replace occurrences of REPLACE with input","-n NUM use at most NUM arguments per command line","-P NUM run at most NUM processes at a time","-0, --null items are separated by null, not whitespace","-t, --verbose print commands before executing","-r, --no-run-if-empty do not run command if input is empty"," --help display this help and exit"]},E={name:"xargs",async execute(n,u){if(A(n))return b(P);let p=null,c=null,l=null,h=!1,x=!1,g=!1,r=0;for(let t=0;t<n.length;t++){let e=n[t];if(e==="-I"&&t+1<n.length)p=n[++t],r=t+1;else if(e==="-n"&&t+1<n.length)c=parseInt(n[++t],10),r=t+1;else if(e==="-P"&&t+1<n.length)l=parseInt(n[++t],10),r=t+1;else if(e==="-0"||e==="--null")h=!0,r=t+1;else if(e==="-t"||e==="--verbose")x=!0,r=t+1;else if(e==="-r"||e==="--no-run-if-empty")g=!0,r=t+1;else{if(e.startsWith("--"))return w("xargs",e);if(e.startsWith("-")&&e.length>1){for(let s of e.slice(1))if(!"0tr".includes(s))return w("xargs",`-${s}`);e.includes("0")&&(h=!0),e.includes("t")&&(x=!0),e.includes("r")&&(g=!0),r=t+1}else if(!e.startsWith("-")){r=t;break}}}let o=n.slice(r);o.length===0&&o.push("echo");let I=h?"\0":/\s+/,i=u.stdin.split(I).map(t=>t.trim()).filter(t=>t.length>0);if(i.length===0)return g?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};let d="",a="",m=0,C=async t=>{let e=t.join(" ");return x&&(a+=`${e}
3
+ `),u.exec?u.exec(e,{cwd:u.cwd}):{stdout:`${e}
4
+ `,stderr:"",exitCode:0}},y=async t=>{if(l!==null&&l>1)for(let e=0;e<t.length;e+=l){let s=t.slice(e,e+l),N=await Promise.all(s.map(C));for(let f of N)d+=f.stdout,a+=f.stderr,f.exitCode!==0&&(m=f.exitCode)}else for(let e of t){let s=await C(e);d+=s.stdout,a+=s.stderr,s.exitCode!==0&&(m=s.exitCode)}};if(p!==null){let t=i.map(e=>o.map(s=>s.replaceAll(p,e)));await y(t)}else if(c!==null){let t=[];for(let e=0;e<i.length;e+=c){let s=i.slice(e,e+c);t.push([...o,...s])}await y(t)}else{let t=[...o,...i],e=await C(t);d+=e.stdout,a+=e.stderr,m=e.exitCode}return{stdout:d,stderr:a,exitCode:m}}};export{E as xargsCommand};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{a as b,b as A,c as y}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var N={name:"xargs",summary:"build and execute command lines from standard input",usage:"xargs [OPTION]... [COMMAND [INITIAL-ARGS]]",options:["-I REPLACE replace occurrences of REPLACE with input","-n NUM use at most NUM arguments per command line","-P NUM run at most NUM processes at a time","-0, --null items are separated by null, not whitespace","-t, --verbose print commands before executing","-r, --no-run-if-empty do not run command if input is empty"," --help display this help and exit"]},E={name:"xargs",async execute(n,u){if(A(n))return b(N);let h=null,c=null,l=null,x=!1,g=!1,C=!1,r=0;for(let t=0;t<n.length;t++){let e=n[t];if(e==="-I"&&t+1<n.length)h=n[++t],r=t+1;else if(e==="-n"&&t+1<n.length)c=parseInt(n[++t],10),r=t+1;else if(e==="-P"&&t+1<n.length)l=parseInt(n[++t],10),r=t+1;else if(e==="-0"||e==="--null")x=!0,r=t+1;else if(e==="-t"||e==="--verbose")g=!0,r=t+1;else if(e==="-r"||e==="--no-run-if-empty")C=!0,r=t+1;else{if(e.startsWith("--"))return y("xargs",e);if(e.startsWith("-")&&e.length>1){for(let f of e.slice(1))if(!"0trnIP".includes(f))return y("xargs",`-${f}`);e.includes("0")&&(x=!0),e.includes("t")&&(g=!0),e.includes("r")&&(C=!0),r=t+1}else if(!e.startsWith("-")){r=t;break}}}let o=n.slice(r);o.length===0&&o.push("echo");let P=x?"\0":/\s+/,i=u.stdin.split(P).map(t=>t.trim()).filter(t=>t.length>0);if(i.length===0)return C?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};let d="",a="",m=0,w=async t=>{let e=t.join(" ");return g&&(a+=`${e}
3
+ `),u.exec?u.exec(e,{cwd:u.cwd}):{stdout:`${e}
4
+ `,stderr:"",exitCode:0}},I=async t=>{if(l!==null&&l>1)for(let e=0;e<t.length;e+=l){let s=t.slice(e,e+l),f=await Promise.all(s.map(w));for(let p of f)d+=p.stdout,a+=p.stderr,p.exitCode!==0&&(m=p.exitCode)}else for(let e of t){let s=await w(e);d+=s.stdout,a+=s.stderr,s.exitCode!==0&&(m=s.exitCode)}};if(h!==null){let t=i.map(e=>o.map(s=>s.replaceAll(h,e)));await I(t)}else if(c!==null){let t=[];for(let e=0;e<i.length;e+=c){let s=i.slice(e,e+c);t.push([...o,...s])}await I(t)}else{let t=[...o,...i],e=await w(t);d+=e.stdout,a+=e.stderr,m=e.exitCode}return{stdout:d,stderr:a,exitCode:m}}};export{E as xargsCommand};