Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jira issue new throwing an error #20

Closed
iJebus opened this issue Jan 17, 2017 · 5 comments
Closed

jira issue new throwing an error #20

iJebus opened this issue Jan 17, 2017 · 5 comments

Comments

@iJebus
Copy link

iJebus commented Jan 17, 2017

Running tejira 0.3.2. Finding it less than immediately obvious to discover what version of Jira Rest API and Agile Rest API is running so apologies in advance if this is likely to be the problem.

jira issue new

Choose project? (Use arrow keys, press Enter to select)
‣ ADM - Admin
  DEV - Development

Choose project? ADM - Admin
default index `1` out of range (1 - 0)

The same error is thrown for either selection. List commands are working however and some of the other stuff (e.g. commenting).

@keepcosmos
Copy link
Owner

Could you tell me which version of tty-prompt are you using?

@iJebus
Copy link
Author

iJebus commented Jan 18, 2017

Sure, that's tty-prompt (0.9.0) on ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16].

I also just tried installing it on a new rbenv environment running ruby 2.3.0 and I'm seeing the same error. tty-prompt is that same version on the fresh install.

@keepcosmos
Copy link
Owner

@piotrmurach Chould you give me some hint?

@piotrmurach
Copy link

Hi,

The error default index 1 out of range (1 - 0) is only thrown when index of default option is out of range of all choices. The zero means that the array of projects is empty at this point. By default tty-prompt will set first element in the array as default choice. However, if the menu is created with no choices then it will throw an error. I would suspect that at this point there are no projects fetched. To replicate this error do:

prompt = TTY::Prompt.new('Choose project?', [ ], 1)

When I wrote that code I wanted to make sure that prompt cannot be created without the actual menu items. I suppose I could add another error that specifically tells you that you are trying to create an empty menu. Would that help?

@keepcosmos
Copy link
Owner

Thanks, @piotrmurach

@iJebus said,

Choose project? (Use arrow keys, press Enter to select)
‣ ADM - Admin
DEV - Development

and

Choose project? ADM - Admin

are printed.

I also checked, https://github.com/piotrmurach/tty-prompt/blob/82750f4c56b5e8decd8d822b79fce29af17d1c8e/lib/tty/prompt/list.rb#L177-L188

@iJebus can you debug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants