File: cli.rst

package info (click to toggle)
hy 0.10.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,220 kB
  • ctags: 484
  • sloc: python: 3,737; makefile: 207; sh: 20
file content (103 lines) | stat: -rw-r--r-- 1,633 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
======================
Command Line Interface
======================

.. _hy:

hy
--

Command line options
^^^^^^^^^^^^^^^^^^^^

.. cmdoption:: -c <command>

   Execute the Hy code in *command*.

   .. code-block:: bash

      $ hy -c "(print (+ 2 2))"
      4

.. cmdoption:: -i <command>

   Execute the Hy code in *command*, then stay in REPL.

.. cmdoption:: --spy

   Print equivalent Python code before executing. For example::

    => (defn salutationsnm [name] (print (+ "Hy " name "!")))
    def salutationsnm(name):
        return print(((u'Hy ' + name) + u'!'))
    => (salutationsnm "YourName")
    salutationsnm(u'YourName')
    Hy YourName!
    =>

   .. versionadded:: 0.9.11

.. cmdoption:: --show-tracebacks

   Print extended tracebacks for Hy exceptions.

   .. versionadded:: 0.9.12

.. cmdoption:: -v

   Print the Hy version number and exit.


.. _hyc:

hyc
---

Command line options
^^^^^^^^^^^^^^^^^^^^

.. cmdoption:: file[, fileN]

   Compile Hy code to Python bytecode. For example, save the
   following code as ``hyname.hy``:

   .. code-block:: hy

      (defn hy-hy [name]
        (print (+ "Hy " name "!")))

      (hy-hy "Afroman")

   Then run:

   .. code-block:: bash

      $ hyc hyname.hy
      $ python hyname.pyc
      Hy Afroman!


.. _hy2py:

hy2py
-----

.. versionadded:: 0.10.1

Command line options
^^^^^^^^^^^^^^^^^^^^

.. cmdoption:: -s
               --with-source

   Show the parsed source structure.

.. cmdoption:: -a
               --with-ast

   Show the generated AST.

.. cmdoption:: -np
               --without-python

   Do not show the Python code generated from the AST.