Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from Jul 23, 2012

Conversation

diogomafra
Copy link
Contributor

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.

@drewdeponte
Copy link
Owner

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

@diogomafra
Copy link
Contributor Author

@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.

@drewdeponte
Copy link
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.

@diogomafra
Copy link
Contributor Author

Ok, no problem.

drewdeponte added a commit that referenced this pull request Jul 23, 2012
Clear the output window when a predefined text is found.
@drewdeponte drewdeponte merged commit eda275d into drewdeponte:master Jul 23, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants