Skip to content

Commit

Permalink
fix #46
Browse files Browse the repository at this point in the history
--script should ignore comments starting with #
  • Loading branch information
slingamn committed Jul 14, 2024
1 parent 7f70307 commit ed3246a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ func ReadScript(filename string) (commands []string, err error) {
reader := bufio.NewReader(infile)
for {
line, err := reader.ReadString('\n')
if command := strings.TrimRight(line, "\r\n"); command != "" {
command := strings.TrimRight(line, "\r\n")
command = strings.TrimLeft(command, " \t\v\r")
if command != "" && !strings.HasPrefix(command, "#") {
commands = append(commands, command)
}
if err == io.EOF {
Expand Down

0 comments on commit ed3246a

Please sign in to comment.