diff --git a/check.anko b/check.anko index 6598ad0..732c8e3 100644 --- a/check.anko +++ b/check.anko @@ -2,7 +2,9 @@ e = 5 v = 53 println(e + v) -println("cock", Cmd("ls").Stdout()) +for v in Cmd("ls").Stdout().ShSplit() { + println("file:", v) +} if v < 55 { println("it fucking works") diff --git a/src/tool/script/main.go b/src/tool/script/main.go index 579435b..719538c 100644 --- a/src/tool/script/main.go +++ b/src/tool/script/main.go @@ -37,12 +37,23 @@ var ( args []string e *env.Env //flag *mtool.Flags + // Standard shell separators. + shSeps = "\t\r\n " ) func (o Output) String() string { return string(o) } +func (o Output) ShSplit() []string { + return strings.Fields(string(o)) +} + +func (o Output) Split(sep string) []string { + return strings.Split(o.String(), sep) +} + + func Run(flagSet *mtool.Flags) { printVersion := flagSet.Bool("v", false, "prints out the version and then exits")