MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / selectDevice

Function selectDevice

src/cli/commands/setup.ts:800–838  ·  view source on GitHub ↗
(opts: {
  existingDeviceId?: string;
  fs: FileSystemExecutor;
  executor: CommandExecutor;
  prompter: Prompter;
  isTTY: boolean;
  quietOutput: boolean;
})

Source from the content-addressed store, hash-verified

798}
799
800async function selectDevice(opts: {
801 existingDeviceId?: string;
802 fs: FileSystemExecutor;
803 executor: CommandExecutor;
804 prompter: Prompter;
805 isTTY: boolean;
806 quietOutput: boolean;
807}): Promise<SetupDevice | null> {
808 const devices = await withSpinner({
809 isTTY: opts.isTTY,
810 quietOutput: opts.quietOutput,
811 startMessage: 'Loading devices...',
812 stopMessage: 'Devices loaded.',
813 task: () => listAvailableDevices(opts.fs, opts.executor),
814 });
815
816 const defaultIndex =
817 devices.length > 0 ? getDefaultDeviceIndex(devices, opts.existingDeviceId) : 0;
818
819 showPromptHelp(
820 'Select a device to set the default target used by physical-device commands.',
821 opts.quietOutput,
822 );
823 return opts.prompter.selectOne({
824 message: 'Select a device',
825 options: [
826 {
827 value: null,
828 label: 'No default device',
829 description: 'Leave device commands unpinned during setup.',
830 },
831 ...devices.map((device) => ({
832 value: device,
833 label: `${device.platform} — ${device.name} (${device.udid})`,
834 })),
835 ],
836 initialIndex: devices.length > 0 && opts.existingDeviceId != null ? defaultIndex + 1 : 0,
837 });
838}
839
840async function ensureSetupPrerequisites(opts: {
841 executor: CommandExecutor;

Callers 1

collectSetupSelectionFunction · 0.85

Calls 5

withSpinnerFunction · 0.85
listAvailableDevicesFunction · 0.85
getDefaultDeviceIndexFunction · 0.85
showPromptHelpFunction · 0.85
selectOneMethod · 0.80

Tested by

no test coverage detected