import{createRequire} from"node:module";const require=createRequire(import.meta.url); import{c as m}from"./chunk-XEKXHOPO.js";import{a as x}from"./chunk-QIQMJJZ4.js";import{a as g,b as y}from"./chunk-QAYAQNCG.js";var L={name:"paste",summary:"merge lines of files",usage:"paste [OPTION]... [FILE]...",description:["Write lines consisting of the sequentially corresponding lines from","each FILE, separated by TABs, to standard output.","","With no FILE, or when FILE is -, read standard input."],options:["-d, --delimiters=LIST reuse characters from LIST instead of TABs","-s, --serial paste one file at a time instead of in parallel"," --help display this help and exit"],examples:["paste file1 file2 Merge file1 and file2 side by side","paste -d, file1 file2 Use comma as delimiter","paste -s file1 Paste all lines of file1 on one line","paste - - < file Paste pairs of lines from file"]},T={delimiter:{short:"d",long:"delimiters",type:"string",default:" "},serial:{short:"s",long:"serial",type:"boolean"}},w={name:"paste",async execute(s,n){if(y(s))return g(L);let i=x("paste",s,T);if(!i.ok)return i.error;let l=i.result.flags.delimiter,d=i.result.flags.serial,p=i.result.positional;if(p.length===0)return{stdout:"",stderr:`usage: paste [-s] [-d delimiters] file ... `,exitCode:1};let c=m(n.stdin),a=c?c.split(` `):[""];a.length>0&&a[a.length-1]===""&&a.pop();let F=p.filter(e=>e==="-").length,f=[],h=0;for(let e of p)if(e==="-"){let t=[];for(let o=h;o0&&r[r.length-1]===""&&r.pop(),f.push(r)}catch{return{stdout:"",stderr:`paste: ${e}: No such file or directory `,exitCode:1}}}let u="";if(d)for(let e of f)e&&(u+=`${I(e,l)} `);else{let e=Math.max(...f.map(t=>t?.length??0));for(let t=0;t