0

how can I pass Jira Ticket-ID as a command-line argument to the ruby script? I'm using Jira-ruby gem. I have a script in which I have to find a particular Jira ticket and comment on it. I want to pass that ticket from the command line to the ruby script. Thanks in advance

jira_client.Issue.find("ID-10389")
    comment = issue.comments.build
    comment.save!(:body => "New comment from example script")`
end
HK boy
  • 1,398
  • 11
  • 17
  • 25
Chaitali
  • 87
  • 13
  • Does this answer your question? [Pass variables to Ruby script via command line](https://stackoverflow.com/questions/4244611/pass-variables-to-ruby-script-via-command-line) – pjs Jan 30 '20 at 21:36

1 Answers1

0

You can use ARGV that contains all string passed as an argument to the command line.

You may try something like this using a splat operator: id, *the_rest = ARGV. Then you can use the local variable id to call the jira_client.Issue.find method.