diff --git a/lib/listen/cli.rb b/lib/listen/cli.rb index 6fcfbe46..e3173133 100644 --- a/lib/listen/cli.rb +++ b/lib/listen/cli.rb @@ -18,9 +18,9 @@ class CLI < Thor class_option :directory, type: :array, - default: '.', + default: ['.'], aliases: '-d', - banner: 'The directory to listen to' + banner: 'One or more directories to listen to' class_option :relative, type: :boolean, @@ -55,7 +55,7 @@ def start end end - listener = Listen.to(directory, relative: relative, &callback) + listener = Listen.to(*directory, relative: relative, &callback) listener.start diff --git a/spec/lib/listen/cli_spec.rb b/spec/lib/listen/cli_spec.rb index 80133a9f..a85381fa 100644 --- a/spec/lib/listen/cli_spec.rb +++ b/spec/lib/listen/cli_spec.rb @@ -15,7 +15,7 @@ let(:options) { %w[] } it 'is set to local directory' do expect(Listen::Forwarder).to receive(:new) do |options| - expect(options[:directory]).to eq('.') + expect(options[:directory]).to eq(['.']) forwarder end described_class.start(options) @@ -108,7 +108,7 @@ it 'passes relative option to Listen' do value = double('value') expect(Listen).to receive(:to). - with(nil, hash_including(relative: value)). + with(hash_including(relative: value)). and_return(listener) described_class.new(relative: value).start