import{r as e,t}from"./chunk-74CEPOFO-V0JXh91S.mjs";import{t as n}from"./chunk-HWKDQ44K-BJxdK4fT.mjs";import{t as r}from"./chunk-X2AJGDEF-ClcErtij.mjs";var i={name:`stat`,summary:`display file or file system status`,usage:`stat [OPTION]... FILE...`,options:[`-c FORMAT   use the specified FORMAT instead of the default`,`    --help  display this help and exit`]},a={format:{short:`c`,type:`string`}},o={name:`stat`,async execute(o,s){if(t(o))return e(i);let c=n(`stat`,o,a);if(!c.ok)return c.error;let l=c.result.flags.format??null,u=c.result.positional;if(u.length===0)return{stdout:``,stderr:`stat: missing operand
`,exitCode:1};let d=``,f=``,p=!1;for(let e of u){let t=s.fs.resolvePath(s.cwd,e);try{let n=await s.fs.stat(t);if(l){let t=l,i=n.mode.toString(8),a=r(n.mode,n.isDirectory);t=t.replace(/%n/g,e),t=t.replace(/%N/g,`'${e}'`),t=t.replace(/%s/g,String(n.size)),t=t.replace(/%F/g,n.isDirectory?`directory`:`regular file`),t=t.replace(/%a/g,i),t=t.replace(/%A/g,a),t=t.replace(/%u/g,`1000`),t=t.replace(/%U/g,`user`),t=t.replace(/%g/g,`1000`),t=t.replace(/%G/g,`group`),d+=`${t}
`}else{let t=n.mode.toString(8).padStart(4,`0`),i=r(n.mode,n.isDirectory);d+=`  File: ${e}
`,d+=`  Size: ${n.size}		Blocks: ${Math.ceil(n.size/512)}
`,d+=`Access: (${t}/${i})
`,d+=`Modify: ${n.mtime.toISOString()}
`}}catch{f+=`stat: cannot stat '${e}': No such file or directory
`,p=!0}}return{stdout:d,stderr:f,exitCode:p?1:0}}},s={name:`stat`,flags:[{flag:`-c`,type:`value`,valueHint:`format`},{flag:`-L`,type:`boolean`}],needsArgs:!0};export{s as n,o as t};
//# sourceMappingURL=chunk-5QVNJEHU-BV0xuiYW.mjs.map