Some clarification on trallop

I would like to understand how trallop works.

test.rb
opts = Trollop::options do

opt :option1, “do something”
opt :option2, “do different something”

end

so i can run test.rb

If arguement 1 matches :option1, it will perform “do something”

I am not getting this one right. i am looking for a commandline parser
for my app and lookedup at trallop.