{
  "version": 3,
  "sources": ["../../../../src/packages/plugin-commands-completion/getShell.ts"],
  "sourcesContent": ["import { PnpmError } from '../error/index.ts';\nimport {\n  isShellSupported,\n  SUPPORTED_SHELLS,\n  type SupportedShell,\n} from '@pnpm/tabtab';\n\nexport function getShellFromString(shell?: string | undefined): SupportedShell {\n  const newShell = shell?.trim();\n\n  if (typeof newShell === 'undefined') {\n    throw new PnpmError(\n      'MISSING_SHELL_NAME',\n      '`pnpm completion` requires a shell name'\n    );\n  }\n\n  if (!isShellSupported(newShell)) {\n    throw new PnpmError('UNSUPPORTED_SHELL', `'${newShell}' is not supported`, {\n      hint: `Supported shells are: ${SUPPORTED_SHELLS.join(', ')}`,\n    });\n  }\n\n  return newShell;\n}\n\nexport function getShellFromParams(params: string[]): SupportedShell {\n  const [shell, ...rest] = params;\n\n  if (rest.length) {\n    throw new PnpmError(\n      'REDUNDANT_PARAMETERS',\n      `The ${rest.length} parameters after shell is not necessary`\n    );\n  }\n\n  return getShellFromString(shell);\n}\n"],
  "mappings": "AAAA,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AAEA,SAAS,mBAAmB,OAA4C;AAC7E,QAAM,WAAW,OAAO,KAAK;AAE7B,MAAI,OAAO,aAAa,aAAa;AACnC,UAAM,IAAI;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,iBAAiB,QAAQ,GAAG;AAC/B,UAAM,IAAI,UAAU,qBAAqB,IAAI,QAAQ,sBAAsB;AAAA,MACzE,MAAM,yBAAyB,iBAAiB,KAAK,IAAI,CAAC;AAAA,IAC5D,CAAC;AAAA,EACH;AAEA,SAAO;AACT;AAEO,SAAS,mBAAmB,QAAkC;AACnE,QAAM,CAAC,OAAO,GAAG,IAAI,IAAI;AAEzB,MAAI,KAAK,QAAQ;AACf,UAAM,IAAI;AAAA,MACR;AAAA,MACA,OAAO,KAAK,MAAM;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,mBAAmB,KAAK;AACjC;",
  "names": []
}
