summaryrefslogtreecommitdiff
path: root/blatube.rb
diff options
context:
space:
mode:
authorotherl <lgdmiller@gmail.com>2013-09-28 19:56:11 +0100
committerotherl <lgdmiller@gmail.com>2013-09-28 19:56:11 +0100
commit0d21460c7516a0c62bd47d530a9750b452e60e4e (patch)
tree6b92dc67185aebff05b088bd50f70b6d1e0b0527 /blatube.rb
parent0c5f69efd87a8a34b3818ad0aee3e88b43373c5c (diff)
Changed status to take an optional argument. Fixed a bug that caused the weight to default to nil if an unrecognised weight was given.
Diffstat (limited to 'blatube.rb')
-rw-r--r--blatube.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/blatube.rb b/blatube.rb
index da208cc..82f5009 100644
--- a/blatube.rb
+++ b/blatube.rb
@@ -23,10 +23,10 @@ args = ARGV.dup
options = OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename($0)} -h"
- opts.on( '-s', '--status LINE', 'Get the current status of a tube line.' ) {|l| @line = l }
+ opts.on( '-s', '--status [LINE]', 'Get the current status of a tube line.' ) {|l| @line = l || 'summary' }
opts.on( '-f', '--from-station STATION', 'Find route from this station.' ) {|f| @from_station = f }
opts.on( '-t', '--to-station STATION', 'Find route to this station.' ) {|t| @to_station = t }
- opts.on( '-w', '--weight WEIGHT', 'Shortest route using either distance, peak_time, off_peak_time or unimpeded_time.' ) {|w| @weight = w if WEIGHTS.include? w || 'peak_time' }
+ opts.on( '-w', '--weight WEIGHT', 'Shortest route using either distance, peak_time, off_peak_time or unimpeded_time.' ) {|w| @weight = WEIGHTS.include?(w) ? w : 'peak_time' }
opts.on( '-c', '--change-time TIME', 'Your expected average change time in minutes.' ) {|c| @change_time = c.to_f.round(2) }
opts.on( '-C', '--colour', 'Enable line colours in the output.' ) { @colour = true }
opts.on( '-d', '--debug', 'Display debug info.' ) { debug = true }