File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed
src/compiler/crystal/command Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change 3
3
class Crystal::Command
4
4
private def eval
5
5
compiler = new_compiler
6
+ program_source = " "
7
+ program_args = [] of String
8
+
6
9
parse_with_crystal_opts do |opts |
7
10
opts.banner = " Usage: crystal eval [options] [source]\n\n Options:"
8
11
setup_simple_compiler_options compiler, opts
12
+
13
+ opts.unknown_args do |before_dash , after_dash |
14
+ program_source = before_dash.join " "
15
+ program_args = after_dash
16
+ end
9
17
end
10
18
11
- if options .empty?
19
+ if program_source .empty?
12
20
program_source = STDIN .gets_to_end
13
- program_args = [] of String
14
- else
15
- double_dash_index = options.index(" --" )
16
- if double_dash_index
17
- program_source = options[0 ...double_dash_index].join " "
18
- program_args = options[double_dash_index + 1 ..- 1 ]
19
- else
20
- program_source = options.join " "
21
- program_args = [] of String
22
- end
23
21
end
24
22
25
23
sources = [Compiler ::Source .new(" eval" , program_source)]
You can’t perform that action at this time.
0 commit comments