cli icon indicating copy to clipboard operation
cli copied to clipboard

WIP: feat: List available apple devices

Open esthor opened this issue 2 years ago β€’ 7 comments

Summary:

Hey, so this is a WIP for listing available apple devices in an interactive cli prompt. The intention of this is to be able to let the user select an available simulator vs. having to paste device name/udid strings in.

I wanted to put this up as a WIP first because I don't know which path to take next...

  1. I could have this be its own helper function, that just lists out the sims (its current state) -- Do we want this as an optional helper for users?
  2. I could merge it into the run-ios flow (initial thoughts: if user doesn't select a sim, one isn't booted or the one they supply isn't available/existing, instead of fallbacks we give this prompt and then carry-on the run-ios command)
  3. Something else? Maybe a combination of 1 & 2 (it's available standalone, and also inside run-ios)? πŸ€”

Some advice would be really helpful here as my only experience with the CLI has been my own (and teams') usage. I don't feel I have the context to make a judgement call here for a whole community. Maybe it's super obvious/simple, I just don't know 🀷

Test Plan:

WIP

esthor avatar Aug 12 '22 18:08 esthor

How does it look like from the UI perspective? Can you share a screenshot maybe? :)

thymikee avatar Aug 17 '22 16:08 thymikee

Yeah, definitely. It looks like this right now:

Screen Recording 2022-08-22 at 12 24 28 PM

esthor avatar Aug 22 '22 19:08 esthor

I was thinking about it a bit more, and it should probably not be its own function, but be added to the run-ios command. I think in two cases:

  1. By passing an extra argument/flag like run-ios --list-simulators
  2. Replacing the fallbackSimulators logic with this interactive approach. (fallbackSimulators seems kinda jank anyway...I'd thought of having them live together, but fallbackSimulators seems like a pain to maintain and is a "dumb" approach compared to just asking the user what they want in a simple way vs. assuming)

What do you think?

esthor avatar Aug 22 '22 19:08 esthor

This looks nice! Any chance it could list connected real devices as well as simulators too?

liamjones avatar Aug 23 '22 07:08 liamjones

Thanks for the contribution @esthor ! πŸ’ͺ

I wanted to put this up as a WIP first because I don't know which path to take next... I could have this be its own helper function, that just lists out the sims (its current state) -- Do we want this as an optional helper for users? I could merge it into the run-ios flow (initial thoughts: if user doesn't select a sim, one isn't booted or the one they supply isn't available/existing, instead of fallbacks we give this prompt and then carry-on the run-ios command) Something else? Maybe a combination of 1 & 2 (it's available standalone, and also inside run-ios)? πŸ€”

Maybe sth like what doctor is doing? List available devices and if user taps "exit" key we will skip selection of device and fall back to default behaviour? WDYT?

Also, can you add (Booted) info for your listing to show which device is booted and can be used?

adamTrz avatar Aug 26 '22 12:08 adamTrz

This looks nice! Any chance it could list connected real devices as well as simulators too?

Yes! Good call. I didn't test this out, but should be doable. I'll put them at the top, and maybe flag them in some way that makes it obvious. I'm imagining that in most cases, if you have a connected physical device, your intention is probably to use that, so I'll put those first.

esthor avatar Sep 12 '22 17:09 esthor

Thanks for the contribution @esthor ! πŸ’ͺ

I wanted to put this up as a WIP first because I don't know which path to take next... I could have this be its own helper function, that just lists out the sims (its current state) -- Do we want this as an optional helper for users? I could merge it into the run-ios flow (initial thoughts: if user doesn't select a sim, one isn't booted or the one they supply isn't available/existing, instead of fallbacks we give this prompt and then carry-on the run-ios command) Something else? Maybe a combination of 1 & 2 (it's available standalone, and also inside run-ios)? πŸ€”

Maybe sth like what doctor is doing? List available devices and if user taps "exit" key we will skip selection of device and fall back to default behaviour? WDYT?

Also, can you add (Booted) info for your listing to show which device is booted and can be used?

Oh, that sounds interesting. I will take a look at how the doctor works, but sounds very good to me.

And yeah, will add a Booted and a Connected flag or section or some way to call those out and have them show at the top of the list.

  • [ ] Add 'Booted' / 'Available'
  • [ ] Add 'Connected Physical Devices'

esthor avatar Sep 12 '22 17:09 esthor

Hi @esthor . Do you need any assistance with wrapping this PR? πŸ™‚ Happy to help and continue on this PR if you are swarmed with other tasks :)

adamTrz avatar Dec 07 '22 14:12 adamTrz

Hey! Going to look at it this week. πŸ™

esthor avatar Dec 21 '22 21:12 esthor

Took the liberty of pushing this PR a bit further - add --list-devices param option to run-ios command:

Screenshot 2023-01-20 at 15 49 03

As visible on screenshot we will also now show connected iPhone's as well.

adamTrz avatar Jan 20 '23 15:01 adamTrz

Oh my gosh. You guys are fantastic. Sorry for delaying this so much. Turns out having a new child can throw off my scheduling. πŸ˜‚ πŸ‘¨β€πŸΌ Please lmk how I can assist today

esthor avatar Jan 20 '23 17:01 esthor

Oh my gosh. You guys are fantastic. Sorry for delaying this so much. Turns out having a new child can throw off my scheduling. πŸ˜‚ πŸ‘¨β€πŸΌ Please lmk how I can assist today

No worries, there are priorities I guess πŸ‘ΆπŸ»

You can try to run it locally and see how it goes ;)

adamTrz avatar Jan 20 '23 17:01 adamTrz

Nice! Ran it locally, and it's looks great for both iOS and Android! πŸš€

esthor avatar Jan 24 '23 22:01 esthor