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

Add mage watch command #563

Merged
merged 4 commits into from Nov 17, 2022
Merged

Add mage watch command #563

merged 4 commits into from Nov 17, 2022

Conversation

toddtreece
Copy link
Member

What this PR does / why we need it:

This adds a mage watch command that uses bra to watch for changes to .go files in the pkg directory of a plugin. A default .bra.toml config is created if it does not exist.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:
It's unclear if bra is the best option for this task, but it seemed like a safe choice since grafana uses it.

@toddtreece toddtreece requested a review from a team as a code owner November 16, 2022 18:51
@toddtreece toddtreece self-assigned this Nov 16, 2022
@toddtreece toddtreece requested review from wbrowne and marefr and removed request for a team November 16, 2022 18:51
@CLAassistant
Copy link

CLAassistant commented Nov 16, 2022

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@@ -11,6 +11,9 @@ min-occurrences = 2
[linters-settings.revive]
ignore-generated-header = false

[linters-settings.misspell]
ignore-words = ["unknwon"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was needed because the misspell linter was complaining about the "github.com/unknwon/bra/cmd" import

Copy link
Member

@marefr marefr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nice 👍

Added some comments

Can you please make sure to update the following documentation when this is merged:

app.Action = func(c *cli.Context) error {
return bra.Run.Run(c)
}
return app.Run(os.Args)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to verify this works on Windows, maybe you can ask someone when this has been merged?

watch_all = true
follow_symlinks = false
watch_dirs = [
"pkg",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to reload when plugin.json is changed as well, but maybe leave that for later?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good. i'll add that 👍

thanks for the tip, i wasn't aware that the backend was dependent on plugin.json. how is it used?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added by dc48129. it doesn't look like it's possible to specify a single file, so i configured it to watch for changes to .go or .json files in src or pkg

@toddtreece toddtreece merged commit 3bc0f60 into main Nov 17, 2022
@toddtreece toddtreece deleted the toddtreece/mage-watch branch November 17, 2022 13:09
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

3 participants