import{n as e,r as t,t as n}from"./chunk-74CEPOFO-V0JXh91S.mjs";var r={name:`comm`,summary:`compare two sorted files line by line`,usage:`comm [OPTION]... FILE1 FILE2`,options:[`-1             suppress column 1 (lines unique to FILE1)`,`-2             suppress column 2 (lines unique to FILE2)`,`-3             suppress column 3 (lines that appear in both files)`,`    --help     display this help and exit`]},i={name:`comm`,async execute(i,a){if(n(i))return t(r);let o=!1,s=!1,c=!1,l=[];for(let t of i)if(t===`-1`)o=!0;else if(t===`-2`)s=!0;else if(t===`-3`)c=!0;else if(t===`-12`||t===`-21`)o=!0,s=!0;else if(t===`-13`||t===`-31`)o=!0,c=!0;else if(t===`-23`||t===`-32`)s=!0,c=!0;else if(t===`-123`||t===`-132`||t===`-213`||t===`-231`||t===`-312`||t===`-321`)o=!0,s=!0,c=!0;else{if(t.startsWith(`-`)&&t!==`-`)return e(`comm`,t);l.push(t)}if(l.length!==2)return{stdout:``,stderr:`comm: missing operand
Try 'comm --help' for more information.
`,exitCode:1};let u=async e=>{if(e===`-`)return a.stdin;try{let t=a.fs.resolvePath(a.cwd,e);return await a.fs.readFile(t)}catch{return null}},d=await u(l[0]);if(d===null)return{stdout:``,stderr:`comm: ${l[0]}: No such file or directory
`,exitCode:1};let f=await u(l[1]);if(f===null)return{stdout:``,stderr:`comm: ${l[1]}: No such file or directory
`,exitCode:1};let p=d.split(`
`),m=f.split(`
`);p.length>0&&p[p.length-1]===``&&p.pop(),m.length>0&&m[m.length-1]===``&&m.pop();let h=0,g=0,_=``,v=o?``:`	`,y=(o?``:`	`)+(s?``:`	`);for(;h<p.length||g<m.length;)h>=p.length?(s||(_+=`${v}${m[g]}
`),g++):g>=m.length||p[h]<m[g]?(o||(_+=`${p[h]}
`),h++):p[h]>m[g]?(s||(_+=`${v}${m[g]}
`),g++):(c||(_+=`${y}${p[h]}
`),h++,g++);return{stdout:_,stderr:``,exitCode:0}}},a={name:`comm`,flags:[{flag:`-1`,type:`boolean`},{flag:`-2`,type:`boolean`},{flag:`-3`,type:`boolean`}],needsArgs:!0,minArgs:2};export{a as n,i as t};
//# sourceMappingURL=chunk-Z7JVV2SM-BtFBVQEW.mjs.map