Initial commit
This commit is contained in:
commit
9d9d8ce7d5
19 changed files with 399 additions and 0 deletions
18
internal/parser/parse.go
Normal file
18
internal/parser/parse.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package parser
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"strings"
|
||||
|
||||
"gosh/internal/command"
|
||||
)
|
||||
|
||||
func Parse(input string) command.Definition {
|
||||
scanner := bufio.NewScanner(strings.NewReader(input))
|
||||
scanner.Split(bufio.ScanWords)
|
||||
args := []string{}
|
||||
for scanner.Scan() {
|
||||
args = append(args, scanner.Text())
|
||||
}
|
||||
return args
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue