From dd431b36c21b4a909d3ae0a12a4e607d326ac3cc Mon Sep 17 00:00:00 2001 From: JP Appel Date: Thu, 26 Jun 2025 19:58:48 -0400 Subject: Add support commented lines in shell --- pkg/shell/interpreter.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pkg/shell') diff --git a/pkg/shell/interpreter.go b/pkg/shell/interpreter.go index 3f43f1c..2752512 100644 --- a/pkg/shell/interpreter.go +++ b/pkg/shell/interpreter.go @@ -14,6 +14,8 @@ import ( "golang.org/x/term" ) +const COMMENT_STR = "#" + type Interpreter struct { State State Workers uint @@ -315,6 +317,11 @@ out: func (inter Interpreter) Tokenize(line string) []IToken { var prevType ITokType tokens := make([]IToken, 0, 3) + + if line[:len(COMMENT_STR)] == COMMENT_STR { + return tokens + } + for word := range strings.SplitSeq(line, " ") { trimmedWord := strings.TrimSpace(word) if trimmedWord == "" { -- cgit v1.2.3