Skip to content

Commit

Permalink
reduce line length
Browse files Browse the repository at this point in the history
  • Loading branch information
copiousfreetime committed May 3, 2024
1 parent 2731f8a commit 4d09848
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/launchy/applications/browser.rb
Expand Up @@ -65,7 +65,8 @@ def browser_cmdline
Launchy.log "#{self.class.name} : Using browser value '#{browser}'"
return browser
end
raise Launchy::CommandNotFoundError, "Unable to find a browser command. If this is unexpected, #{Launchy.bug_report_message}"
raise Launchy::CommandNotFoundError,
"Unable to find a browser command. If this is unexpected, #{Launchy.bug_report_message}"
end

def cmd_and_args(uri, _options = {})
Expand Down
5 changes: 4 additions & 1 deletion lib/launchy/runner.rb
Expand Up @@ -6,7 +6,10 @@ module Launchy
#
class Runner
def run(cmd, *args)
raise Launchy::CommandNotFoundError, "No command found to run with args '#{args.join(' ')}'. If this is unexpected, #{Launchy.bug_report_message}" unless cmd
unless cmd
raise Launchy::CommandNotFoundError,
"No command found to run with args '#{args.join(' ')}'. If this is unexpected, #{Launchy.bug_report_message}"
end

if Launchy.dry_run?
$stdout.puts dry_run(cmd, *args)
Expand Down
4 changes: 3 additions & 1 deletion spec/launchy_spec.rb
Expand Up @@ -108,7 +108,9 @@

it "calls the block with the values passed to launchy and the error" do
options = { dry_run: true }
Launchy.open(@invalid_url, dry_run: true) { |e| $stderr.puts "had an error opening #{@invalid_url} with options #{options}: #{e}" }
Launchy.open(@invalid_url, dry_run: true) do |e|
$stderr.puts "had an error opening #{@invalid_url} with options #{options}: #{e}"
end
_($stderr.string.strip).must_equal "had an error opening #{@invalid_url} with options #{options}: No application found to handle '#{@invalid_url}'"
end

Expand Down

0 comments on commit 4d09848

Please sign in to comment.