Command Line Interface¶
hy¶
Command Line Options¶
- -c <command>¶
Execute the Hy code in command.
$ hy -c "(print (+ 2 2))" 4
- -i <command>¶
Execute the Hy code in command, then stay in REPL.
- -m <module>¶
Execute the Hy code in module, including
defmain
if defined.The
-m
flag terminates the options list so that all arguments after the module name are passed to the module insys.argv
.New in version 0.11.0.
- --spy¶
Print equivalent Python code before executing in REPL. For example:
=> (defn salutationsnm [name] (print (+ "Hy " name "!"))) def salutationsnm(name): return print('Hy ' + name + '!') => (salutationsnm "YourName") salutationsnm('YourName') Hy YourName! =>
–spy only works on REPL mode. .. versionadded:: 0.9.11
- --repl-output-fn¶
Format REPL output using specific function (e.g.,
repr
)New in version 0.13.0.
- -v¶
Print the Hy version number and exit.
hyc¶
Command Line Options¶
- file[, fileN]¶
Compile Hy code to Python bytecode. For example, save the following code as
hyname.hy
:(defn hy-hy [name] (print (+ "Hy " name "!"))) (hy-hy "Afroman")
Then run:
$ hyc hyname.hy $ python hyname.pyc Hy Afroman!
hy2py¶
New in version 0.10.1.