Skip to content

Commit

Permalink
Merge pull request #11 from akhillb/silent_option
Browse files Browse the repository at this point in the history
Silent option
  • Loading branch information
bennylope committed Nov 21, 2015
2 parents 6690643 + de449d4 commit b0f50db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions README.md
Expand Up @@ -83,6 +83,15 @@ the job is complete.
screenshooter shoot path_to/browsers.yaml -u http://www.github.com -w
screenshooter shoot path_to/browsers.yaml -u http://www.github.com --wait

### Silence Progress bar

The command accepts an optional boolean flag, 'quiet', which will not
print the progress bar, while using the 'wait' option. The screenshot
URL will be printed once the job is complete

screenshooter shoot path_to/browsers.yaml -u http://www.github.com --wait -q
screenshooter shoot path_to/browsers.yaml -u http://www.github.com --wait -quiet

### Open the screenshots URL

The command accepts an optional boolean flag, `open`, which will open
Expand Down
5 changes: 3 additions & 2 deletions lib/screenshooter.rb
Expand Up @@ -31,6 +31,7 @@ def list
method_option :url, :aliases => "-u", :desc => "URL of page to screenshot"
method_option :wait, :type => :boolean, :aliases => "-w", :default => false, :desc => "Wait for screenshots to be rendered?"
method_option :open, :type => :boolean, :aliases => "-o", :default => false, :desc => "Open the URL in the browser?"
method_option :quiet, :type => :boolean, :aliases => "-q", :default => false, :desc => "Don't show progress bar"
def shoot(file="browsers.yaml")
username, password = get_credentials
client = Screenshot::Client.new({"username" => username, "password" => password})
Expand All @@ -51,11 +52,11 @@ def shoot(file="browsers.yaml")
end

shot_status = "pending"
bar = ProgressBar.new(:elapsed)
bar = ProgressBar.new(:elapsed) unless options[:quiet]
begin
shot_status = client.screenshots_status request_id
sleep 2.5
bar.increment!
bar.increment! unless options[:quiet]
end while options["wait"] and shot_status != "done"

screenshots_url = "http://www.browserstack.com/screenshots/#{request_id}"
Expand Down

0 comments on commit b0f50db

Please sign in to comment.