var f=(n,e,t)=>new Promise((c,i)=>{var p=r=>{try{a(t.next(r))}catch(o){i(o)}},d=r=>{try{a(t.throw(r))}catch(o){i(o)}},a=r=>r.done?c(r.value):Promise.resolve(r.value).then(p,d);a((t=t.apply(n,e)).next())});var l="https://getcomposer.org/img/logo-composer-transparent5.png",y=new RegExp("^.*/.*$"),h={script:function(n){if(n[n.length-1]==="")return;let e=n[n.length-1];return["curl","-s","-H","Accept: application/json",`https://packagist.org/search.json?q=${e}&per_page=20`]},postProcess:function(n){try{return JSON.parse(n).results.map(e=>({name:e.name,description:e.description,icon:"\u{1F4E6}"}))}catch(e){return[]}}},v={script:["cat","composer.json"],postProcess:function(n){if(n.trim()=="")return[];try{let e=JSON.parse(n),t=e.require||{},c=e["require-dev"]||{};return b(Object.assign(t,c)).map(i=>({name:i,icon:"\u{1F4E6}"}))}catch(e){console.log(e)}return[]}};function b(n){return Object.keys(n).filter(e=>e.match(y))}var k={name:"composer",description:"Composer Command",generateSpec:(n,e)=>f(void 0,null,function*(){let[t,c]=yield Promise.all([e({command:"composer",args:["list","--format=json"]}),e({command:"ls",args:["symfony.lock"]})]),i=[];try{let p=JSON.parse(t.stdout),d=["update","remove"];for(let o of p.commands)i.push({name:o.name,description:o.description,icon:l,args:Object.keys(o.definition.arguments).map(u=>{let s=o.definition.arguments[u],m=s.default?Array.isArray(s.default)?s.default[0]:s.default:void 0;return{name:s.name,description:s.description,isOptional:!s.is_required,default:m,isVariadic:s.is_array,generators:o.name==="require"?h:d.includes(o.name)?v:[]}}),options:Object.keys(o.definition.options).map(u=>{let s=o.definition.options[u],m=[s.name],g=s.shortcut;return g.trim().length>0&&m.push(g),{name:m,description:s.description,isRequired:s.is_value_required,args:s.accept_value?{}:void 0}})});let a=[{name:["-h","--help"],description:"Display this help message"},{name:["-q","--quiet"],description:"Do not output any message"},{name:["-V","--version"],description:"Display this application version"},{name:"--ansi",description:"Force ANSI output",exclusiveOn:["--no-ansi"]},{name:"--no-ansi",description:"Disable ANSI output",exclusiveOn:["--ansi"]},{name:["-n","--no-interaction"],description:"Do not ask any interactive question"},{name:"--profile",description:"Display timing and memory usage information"},{name:"--no-plugins",description:"Whether to disable plugins"},{name:["-d","--working-dir"],description:"If specified, use the given directory as working directory",args:{name:"dir",template:"folders"}},{name:"--no-cache",description:"Prevent use of the cache"},{name:["-v","--verbose"],description:"Verbosity of messages: 1 for normal output"},{name:"-vv",description:"Verbosity of messages: 2 for more verbose output"},{name:"-vvv",description:"Verbosity of messages: 3 for debug"}];c.status===0&&(i.push({name:["recipes","symfony:recipes"],description:"Shows information about all available recipes",icon:l,args:{name:"package",description:"Package to inspect, if not provided all packages are",isOptional:!0},options:[{name:["-o","--outdated"],description:"Show only recipes that are outdated"},...a]}),i.push({name:["recipes:install","symfony:recipes:install","symfony:sync-recipes","sync-recipes","fix-recipes"],description:"Installs or reinstalls recipes for already installed packages",icon:l,args:{name:"packages",description:"Recipes that should be installed",isVariadic:!0},options:[{name:"--force",description:"Overwrite existing files when a new version of a recipe is available",isDangerous:!0},...a]}))}catch(p){console.error(p)}return{name:"composer",subcommands:i}})},O=k;export{O as default};
