Friday, August 28, 2009

Use of getoptlong in Ruby

this post is to describe how to use getoptlong package in ruby. Once i need to use it while i have given a task to generate a csv file in a specified format and need to upload that file into my automated testing tool "TESTDROID". there are some snippet of code that may help you to write code for your own.

you need to require some gem:

the format of getoptlong comments for the help and the text for special help is as follows:


then i need to handle the usage according to my requirements. as you can see that requirement in the last snnipet. so i had to decide which usage option i need to call according to the help option. so i have written a method for this requirement just look at this:

now the question is to call or use wrtten code. so just look at this:


hope this may help you to implement this.
Cheers!!

No comments:

Post a Comment