import{a as E}from"./chunk-FKIVKNOV.js";import{a as S}from"./chunk-6ZRHK4ON.js";import{a as C}from"./chunk-7XQDZF73.js";import{Fa as P,I as x,ha as y,i as F}from"./chunk-UZ7U322K.js";import{b as f}from"./chunk-MQXSMZQZ.js";import{b as w}from"./chunk-Q6LCSRIW.js";import{Fb as n,Hb as d,Lb as v,Ta as h,ma as g,ua as l}from"./chunk-EYDNSYYE.js";import{f as u}from"./chunk-773TIA5M.js";import{r as $}from"./chunk-T6CC5WUU.js";import{e as k,g as p}from"./chunk-VKWPEFWQ.js";p();p();async function _({app:c,remoteApp:t,organization:o,envFile:e}){await y(t,o.source);let r={SHOPIFY_API_KEY:t.apiKey,SHOPIFY_API_SECRET:t.apiSecretKeys[0]?.secret,SCOPES:F(c.configuration)};if(await h(e)){let a=await g(e),s=f(a,r);if(s===a)return d`No changes to ${n.path(e)}`;{await l(e,s);let I=E(a??"",s);return d`Updated ${n.path(e)} to be:

${s}

Here's what changed:

${n.linesDiff(I)}
  `}}else{let a=f(null,r);return await l(e,a),d`Created ${n.path(e)}:

${a}
`}}var b=k($(),1);var m,i=class extends S{async run(){let{flags:t}=await this.parse(m),{app:o,remoteApp:e,organization:r}=await P({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config}),a=u(o.directory,t["env-file"]??x(o.configPath));return v(await _({app:o,remoteApp:e,organization:r,envFile:a})),{app:o}}};m=i;i.summary="Pull app and extensions environment variables.";i.descriptionWithMarkdown="Creates or updates an `.env` files that contains app and app extension environment variables.\n\n  When an existing `.env` file is updated, changes to the variables are displayed in the terminal output. Existing variables and commented variables are preserved.";i.description=m.descriptionWithoutMarkdown();i.flags={...w,...C,"env-file":b.Flags.string({hidden:!1,description:"Specify an environment file to update if the update flag is set",env:"SHOPIFY_FLAG_ENV_FILE"})};var j=i;export{j as a};
