Clear the output window when a predefined text is found. #48

Merged
merged 2 commits into from Jul 23, 2012

Conversation

Projects
None yet
2 participants
@diogomafra
Contributor

diogomafra commented Jun 30, 2012

Hi Andrew. First of all, thank you for this great plugin!

I'm using RSpec with Guard, and every time a file is updated, the corresponding specs are executed. Right now, all the output is appended in the output window, but I would like to clear this window every time RSpec is executed.

I made a change that allows the user to define a text (regex) that, when found, clears the output window.

Some examples of the defined text:

  • "Running: .*_spec.rb"
  • "Running: .*_spec.rb|Failures:"
  • "Running: .*_spec.rb|Failures:|Reloading Spork for RSpec"

How to use

The user must create a json file called "Guard.sublime-settings" in the user config directory ("Packages/User/"). This file has this format:

{
  "clear_when_find_this_text": "Running: .*_spec.rb"
}

The text must be a regular expression. Its possible to use "|" (OR) to find more than one text.

Limitations

I'm loading the settings every time a guard command is executed. If the user change the settings, a guard command must be executed to reload it. It's possible to load the settings inside the append_data method, but I don't know if there is some performance issue with slow computers.

@cyphactor

This comment has been minimized.

Show comment
Hide comment
@cyphactor

cyphactor Jun 30, 2012

Owner

@diogomafra what is your reasoning for wanting it to clear the output window for each test run?

Owner

cyphactor commented Jun 30, 2012

@diogomafra what is your reasoning for wanting it to clear the output window for each test run?

@diogomafra

This comment has been minimized.

Show comment
Hide comment
@diogomafra

diogomafra Jun 30, 2012

Contributor

@cyphactor if some test fails I can scroll to the top easily and see the errors. If all the output is kept together it's harder to see what's the current run output.

Also, when the test fail I don't care for the progress info (the dots "....F......"), I can clear it to make the output simpler.

Contributor

diogomafra commented Jun 30, 2012

@cyphactor if some test fails I can scroll to the top easily and see the errors. If all the output is kept together it's harder to see what's the current run output.

Also, when the test fail I don't care for the progress info (the dots "....F......"), I can clear it to make the output simpler.

@cyphactor

This comment has been minimized.

Show comment
Hide comment
@cyphactor

cyphactor Jun 30, 2012

Owner

Interesting, I don't have time right now to test and merge this in right now. I will have to look at in when I get back later. I will spend some time thinking about it as well and seeing if there is maybe a better way to allow people to config optional things like this as it is very much a personal workflow feature.

Owner

cyphactor commented Jun 30, 2012

Interesting, I don't have time right now to test and merge this in right now. I will have to look at in when I get back later. I will spend some time thinking about it as well and seeing if there is maybe a better way to allow people to config optional things like this as it is very much a personal workflow feature.

@diogomafra

This comment has been minimized.

Show comment
Hide comment
@diogomafra

diogomafra Jun 30, 2012

Contributor

Ok, no problem.

Contributor

diogomafra commented Jun 30, 2012

Ok, no problem.

cyphactor added a commit that referenced this pull request Jul 23, 2012

Merge pull request #48 from diogomafra/clear_output
Clear the output window when a predefined text is found.

@cyphactor cyphactor merged commit eda275d into cyphactor:master Jul 23, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment