How would I parse an angular serve to notify me when its actually started? #351
Answered
by
stevearc
Ajaymamtora
asked this question in
Q&A
-
I have the following return {
name = "ng serve",
builder = function()
return {
cmd = { "ng", "serve" },
components = {
{
"on_output_parse",
parser = require("overseer.parser.angular"),
},
},
}
end,
}
...
return {
"on_output_parse",
parser = {
-- Set up the initial state
{ "set_defaults", values = { status = "running" } },
{
-- Use a loop to continuously parse the output
"loop",
{
"sequence",
-- Check for the success message
{
"extract",
{ consume = true },
"^Application bundle generation complete%.$",
},
-- If found, update the status, notify, and stop the parser
{
"set_defaults",
values = { status = "success" },
},
{
"dispatch",
function(_, _, line)
vim.schedule(function()
vim.notify("Angular serve started successfully: " .. line, vim.log.levels.INFO)
end)
return "stop"
end
},
},
},
},
} I'm fully stuck - I just want to run a callback when the string "Application bundle generation complete" is outputted |
Beta Was this translation helpful? Give feedback.
Answered by
stevearc
Sep 11, 2024
Replies: 1 comment
-
While this can be done with the existing components and parser system, it's not really built for it and will feel pretty clunky. I would suggest creating your own custom component that uses |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Ajaymamtora
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While this can be done with the existing components and parser system, it's not really built for it and will feel pretty clunky. I would suggest creating your own custom component that uses
on_output_lines
to watch for this line and then you can do whatever you want there.