Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
Merge pull request #13 from walfie/ignore-comment
Browse files Browse the repository at this point in the history
Ignore input lines starting with `#` (comments)
  • Loading branch information
Mikulas authored Mar 19, 2019
2 parents 3cc4857 + 2a01819 commit a55cff9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion main/builtin-shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func (b builtinShell) init() error {
}

func (b builtinShell) filter(command string) bool {
return strings.HasPrefix(command, ";")
return strings.HasPrefix(command, ";") || strings.HasPrefix(command, "#")
}

func (b builtinShell) run(command string) error {
Expand Down
4 changes: 2 additions & 2 deletions main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func prompt() (string, error) {
if err != nil {
return "", err
}
response := strings.Trim(line, "\n")
response := strings.TrimSpace(line)
return substituteForVars(response)
}

Expand All @@ -56,7 +56,7 @@ func repl(commands Commands) error {
return err
}

if strings.TrimSpace(command) == "" {
if command == "" {
return nil
}

Expand Down

0 comments on commit a55cff9

Please sign in to comment.