@@ -6,13 +6,14 @@ defmodule ExToJS.CLI do
66 end
77
88 def parse_args ( args ) do
9- switches = [ output: :binary , ast: :boolean , elixir: :boolean , stdio: :boolean ]
9+ switches = [ output: :binary , ast: :boolean , elixir: :boolean , stdio: :boolean , lib: :boolean ]
1010 aliases = [ o: :output , t: :ast , ex: :elixir , st: :stdio ]
1111
1212 parse = OptionParser . parse ( args , switches: switches , aliases: aliases )
1313
1414 case parse do
1515 { [ stdio: true ] , _ , _ } -> { :stdio }
16+ { [ lib: true ] , _ , _ } -> { :lib }
1617 { [ output: output , ast: true , elixir: true ] , [ input ] , _ } -> { input , output , :ast , :elixir }
1718 { [ output: output , ast: true ] , [ input ] , _ } -> { input , output , :ast }
1819 { [ ast: true , elixir: true ] , [ input ] , _ } -> { input , :ast , :elixir }
@@ -86,6 +87,13 @@ defmodule ExToJS.CLI do
8687 end )
8788 end
8889
90+ def process ( { :lib } ) do
91+ path = ExToJS . operating_path
92+
93+ file = File . read! ( "#{ path } /elixir.js" )
94+ IO . write ( file )
95+ end
96+
8997 def process ( { input } ) do
9098 input
9199 |> ExToJS . parse_elixir_files
@@ -108,6 +116,7 @@ defmodule ExToJS.CLI do
108116 -t --ast shows only produced spider monkey ast
109117 -ex --elixir read input as elixir code string
110118 -st --stdio reads from stdio
119+ --lib writes the standard lib js to standard out
111120 -h --help this message
112121 """
113122 end
0 commit comments