crystal-community / icr

Interactive console for Crystal programming language
MIT License
505 stars 40 forks source link

Feature: paste mode #56

Closed Porcupine96 closed 7 years ago

veelenga commented 7 years ago

Tested locally and it works:

icr(0.23.1) > |paste
# Entering paste mode (ctrl-D to finish)
puts "hello"
puts "bro"
[1, 2, 3].each { |e| puts e }
^D

# Ctrl-D was pressed, now interpreting...
hello
bro
1
2
3
 => nil

But I'm not sure if we need this because you can just use parenthesis (or begin, end):

icr(0.23.1) > (
icr(0.23.1) >   puts "hello"
icr(0.23.1) >   puts "bro"
icr(0.23.1) >   [1, 2, 3].each { |e| puts e }
icr(0.23.1) >   )
hello
bro
1
2
3
 => nil

@greyblake WDYT?

Porcupine96 commented 7 years ago

Your call guys. I made the requested changes :)

veelenga commented 7 years ago

Personally I don't see advantages of |pcopy over parens or begin end...

@greyblake @crystal-community/maintainers thoughts?

greyblake commented 7 years ago

I'll take a look tonight.