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

Added Deprecate Property to Watch Flag (Issue #3256) #3440

Merged
merged 5 commits into from
Jun 12, 2020
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions internal/cli/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ type upCmd struct {
hud bool
// whether hud was explicitly set or just got the default value
hudFlagExplicitlySet bool

//whether watch was explicitly set in the cmdline
watchFlagExplicitlySet bool
}

func (c *upCmd) register() *cobra.Command {
Expand Down Expand Up @@ -98,6 +101,7 @@ local resources--i.e. those using serve_cmd--are terminated when you exit Tilt.

cmd.PreRun = func(cmd *cobra.Command, args []string) {
c.hudFlagExplicitlySet = cmd.Flag("hud").Changed
c.watchFlagExplicitlySet = cmd.Flag("watch").Changed
Copy link
Member

Choose a reason for hiding this comment

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

nice solution!

}

return cmd
Expand Down Expand Up @@ -136,6 +140,11 @@ func (c *upCmd) run(ctx context.Context, args []string) error {

logOutput(fmt.Sprintf("Starting Tilt (%s)…", buildStamp()))

//if --watch was set, warn user about deprecation
if c.watchFlagExplicitlySet {
logOutput("Flag --watch has been deprecated, it will be removed in future releases.")
Copy link
Member

Choose a reason for hiding this comment

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

fyi, i think you can also use logger.Get(ctx).Warnf(...) if you want it to show up as a warning in the UI

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Warnf() seems to be doing something interesting - it prints the warning fine on the TUI, but the keyword "warning" doesn't show up on the Web UI for some reason.

Screenshot from 2020-06-12 17-56-14

Screenshot from 2020-06-12 17-57-04

Copy link
Member

Choose a reason for hiding this comment

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

yep! it has the yellow UI bar in the web, and skips the prefix

}

if ok, reason := analytics.IsAnalyticsDisabledFromEnv(); ok {
log.Printf("Tilt analytics disabled: %s", reason)
}
Expand Down