Skip to content

Commit

Permalink
use loginfo for welcome so -quiet supresses it. check in a test and a…
Browse files Browse the repository at this point in the history
…lso don't println result that already include a \n (#88)
  • Loading branch information
ldemailly authored Aug 2, 2024
1 parent 1124530 commit 9cfa42a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func Main() int {
cli.ArgsHelp = "*.gr files to interpret or `-` for stdin without prompt or no arguments for stdin repl..."
cli.MaxArgs = -1
cli.Main()
log.Printf("grol %s - welcome!", cli.LongVersion)
log.Infof("grol %s - welcome!", cli.LongVersion)
options := repl.Options{
ShowParse: *showParse,
ShowEval: *showEval,
Expand All @@ -39,7 +39,7 @@ func Main() int {
if len(errs) > 0 {
log.Errf("Errors: %v", errs)
}
fmt.Println(res)
fmt.Print(res)
return len(errs)
}
if nArgs == 0 {
Expand Down
6 changes: 6 additions & 0 deletions main_test.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ stdout '^1\n3$'
!grol -c 'm=macro(){};m()'
stdout '^<err: macro should return Quote. got=object.Null \({}\)>\n$'

# quiet mode and fast fibbonaci
grol -quiet -c 'fib=func(x){if x<=1 {x} else {fib(x-1)+fib(x-2)}}; fib(92)'
stdout '^7540113804746346429\n$'
!stdout '\n\n'
!stderr .

-- sample_test.gr --
// Sample file that our gorepl can interpret
// <--- comments
Expand Down

0 comments on commit 9cfa42a

Please sign in to comment.