Nexmo / nexmo-cli

Nexmo CLI (Command Line Interface)
https://nexmo.com
MIT License
78 stars 52 forks source link

Support partial app IDs #168

Open lornajane opened 5 years ago

lornajane commented 5 years ago

Steps to reproduce

Looked at my apps: nexmo apps Wondered which numbers were linked for a specific app: nexmo app:numbers .... then I typed a few characters of the start of the app ID. Turns out, you need the whole thing. Not very easy from CLI.

Expected behavior

We should only require enough characters to uniquely identify which app we mean - similar to what git does with revision numbers.

Actual behavior

I had to type all 36 characters despite only having 4 apps and no common starting strings between them.

Ricool06 commented 5 years ago

Hey, @lornajane I'll give this a shot. :+1:

Ricool06 commented 5 years ago

Is it acceptable to make another API call to do this? From what I've read in the code, the only way to do this in this project alone is to retrieve a list of all apps, then fail if 0 or >1 app contains a partial match, and succeed if exactly 1 app ID partially matches the argument.

AlexLakatos commented 5 years ago

Yes, that's acceptable.

Ricool06 commented 5 years ago

Pull request is up, forgot to say. Feedback welcome 😁