From 2ff7bbd4341800abee599473a39a4b5e774b985d Mon Sep 17 00:00:00 2001 From: Swastik Baranwal Date: Sat, 19 Oct 2024 03:08:57 +0530 Subject: [PATCH] feat: warn when using `SET` commands not being the top decl (#508) * feat: warn when using SET commands not being the top decl * refactor: adjust wording --------- Co-authored-by: bashbunni --- evaluator.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/evaluator.go b/evaluator.go index 6d9fa473b..ab9f68715 100644 --- a/evaluator.go +++ b/evaluator.go @@ -152,6 +152,10 @@ func Evaluate(ctx context.Context, tape string, out io.Writer, opts ...Evaluator // // We should remove if isSetting statement. isSetting := cmd.Type == token.SET && cmd.Options != "TypingSpeed" + + if isSetting { + 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))) + } if isSetting || cmd.Type == token.REQUIRE { _, _ = fmt.Fprintln(out, Highlight(cmd, true)) continue