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

Support for inserting a line after a matching line is found #79

Closed
vorezal opened this issue Mar 30, 2018 · 4 comments
Closed

Support for inserting a line after a matching line is found #79

vorezal opened this issue Mar 30, 2018 · 4 comments

Comments

@vorezal
Copy link

vorezal commented Mar 30, 2018

It would be great if this cookbook had the ability to search for a matching line of text and then insert another line after it. It would certainly help keep things organized in config files and the like when templates are not a good option.

I'm going to be away for a bit, but if no one tackles it before I have time I can certainly give it a go myself and submit a PR. I think it should be similar to the replace_or_add functionality (insert_or_add perhaps?), but I can think of a number of edge cases that would need addressing.

@MarkGibbons
Copy link
Member

MarkGibbons commented Jun 6, 2018

Current syntax for this request in #101

filters = Line::Filter.new
filter_lines '/some/file' do
   filter filters.method(:after)
   filter_args [/pattern/, 'insert_line']
end

@vorezal
Copy link
Author

vorezal commented Jun 12, 2018

That looks excellent to me. Way above and beyond what I had been imagining no less. I'm interested to look through the code and see how it all works. Thank you for addressing my request!

@MarkGibbons
Copy link
Member

Fixed by #121

@MarkGibbons MarkGibbons moved this from Triage to Completed in ChefConf2018 Hackables Apr 6, 2019
@lock
Copy link

lock bot commented Oct 6, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Development

No branches or pull requests

3 participants