feat: warn when using SET commands not being the top decl (#508) · charmbracelet/vhs@2ff7bbd (original) (raw)

Original file line number Diff line number Diff line change
@@ -152,6 +152,10 @@ func Evaluate(ctx context.Context, tape string, out io.Writer, opts ...Evaluator
152 152 //
153 153 // We should remove if isSetting statement.
154 154 isSetting := cmd.Type == token.SET && cmd.Options != "TypingSpeed"
155 +
156 +if isSetting {
157 +fmt.Println(ErrorStyle.Render(fmt.Sprintf("WARN: 'Set %s %s' has been ignored. Move the directive to the top of the file.\nLearn more: https://github.com/charmbracelet/vhs#settings", cmd.Options, cmd.Args)))
158 + }
155 159 if isSetting |
156 160 _, _ = fmt.Fprintln(out, Highlight(cmd, true))
157 161 continue