Skip to content

Commit f8a7268

Browse files
committed
Fix crash on empty command input
1 parent bae7d3a commit f8a7268

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

npReview.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@
5151
TOOLS_SCRIPT_PATH = "#{USER_DIR}/bin/npTools".freeze
5252
STATS_SCRIPT_PATH = "#{USER_DIR}/bin/npStats".freeze
5353
NP_SUMMARIES_DIR = "#{USER_DIR}/Dropbox/NPSummaries".freeze
54+
TODAYS_DATE = Date.today # defaults to %Y-%m-%d format. Can't work out why this needs to be a 'constant' to work -- something about visibility, I suppose
5455
SUMMARY_FILENAME = TODAYS_DATE.strftime('%Y%m%d') + '_notes_summary.csv'
5556

5657
#----------------------------------------------------------------------------------
5758
# Constants & other settings
5859
#----------------------------------------------------------------------------------
5960
timeNow = Time.now
60-
TODAYS_DATE = Date.today # defaults to %Y-%m-%d format. Can't work out why this needs to be a 'constant' to work -- something about visibility, I suppose
6161
DROPBOX_DIR = "#{USER_DIR}/Dropbox/Apps/NotePlan/Documents".freeze
6262
ICLOUDDRIVE_DIR = "#{USER_DIR}/Library/Mobile Documents/iCloud~co~noteplan~NotePlan/Documents".freeze
6363
CLOUDKIT_DIR = "#{USER_DIR}/Library/Containers/co.noteplan.NotePlan3/Data/Library/Application Support/co.noteplan.NotePlan3".freeze
@@ -823,6 +823,9 @@ def white_match(needle, haystack_array)
823823
print "\nCommands: re-read & show (a)ll, (e)dit note, s(h)ow stats, people (l)ist, (p)roject+goal lists,".colorize(InstructionColour)
824824
print "\n(q)uit, (r)eview next, (s)ave summary, run (t)ools, re(v)iew list, (w)aiting tasks > ".colorize(InstructionColour)
825825
ARGV.clear # required for 'gets' in the next line not to barf if an ARGV was supplied
826-
input = gets.chomp! # get input from command line, and take off LF
826+
loop do
827+
input = gets.chomp # get input from command line, and take off LF
828+
break if !input.empty?
829+
end
827830
verb = input[0].downcase
828831
end

0 commit comments

Comments
 (0)