27 lines
16 KiB
HTML
27 lines
16 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
|
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=0.8"/><title>24.1 Command-Line Tools</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">►</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">The Racket Guide</a></td></tr></table></div><div class="tocviewsublisttop" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="intro.html" class="tocviewlink" data-pltdoc="x">Welcome to Racket</a></td></tr><tr><td align="right">2 </td><td><a href="to-scheme.html" class="tocviewlink" data-pltdoc="x">Racket Essentials</a></td></tr><tr><td align="right">3 </td><td><a href="datatypes.html" class="tocviewlink" data-pltdoc="x">Built-<wbr></wbr>In Datatypes</a></td></tr><tr><td align="right">4 </td><td><a href="scheme-forms.html" class="tocviewlink" data-pltdoc="x">Expressions and Definitions</a></td></tr><tr><td align="right">5 </td><td><a href="define-struct.html" class="tocviewlink" data-pltdoc="x">Programmer-<wbr></wbr>Defined Datatypes</a></td></tr><tr><td align="right">6 </td><td><a href="modules.html" class="tocviewlink" data-pltdoc="x">Modules</a></td></tr><tr><td align="right">7 </td><td><a href="contracts.html" class="tocviewlink" data-pltdoc="x">Contracts</a></td></tr><tr><td align="right">8 </td><td><a href="i_o.html" class="tocviewlink" data-pltdoc="x">Input and Output</a></td></tr><tr><td align="right">9 </td><td><a href="regexp.html" class="tocviewlink" data-pltdoc="x">Regular Expressions</a></td></tr><tr><td align="right">10 </td><td><a href="control.html" class="tocviewlink" data-pltdoc="x">Exceptions and Control</a></td></tr><tr><td align="right">11 </td><td><a href="for.html" class="tocviewlink" data-pltdoc="x">Iterations and Comprehensions</a></td></tr><tr><td align="right">12 </td><td><a href="match.html" class="tocviewlink" data-pltdoc="x">Pattern Matching</a></td></tr><tr><td align="right">13 </td><td><a href="classes.html" class="tocviewlink" data-pltdoc="x">Classes and Objects</a></td></tr><tr><td align="right">14 </td><td><a href="units.html" class="tocviewlink" data-pltdoc="x">Units</a></td></tr><tr><td align="right">15 </td><td><a href="reflection.html" class="tocviewlink" data-pltdoc="x">Reflection and Dynamic Evaluation</a></td></tr><tr><td align="right">16 </td><td><a href="macros.html" class="tocviewlink" data-pltdoc="x">Macros</a></td></tr><tr><td align="right">17 </td><td><a href="languages.html" class="tocviewlink" data-pltdoc="x">Creating Languages</a></td></tr><tr><td align="right">18 </td><td><a href="concurrency.html" class="tocviewlin
|
||
|
command-line tools that can make racketeering more pleasant.</p><h5 x-source-module="(lib "scribblings/guide/guide.scrbl")" x-source-pkg="racket-doc" x-part-tag=""compile"">24.1.1<tt> </tt><a name="(part._compile)"></a>Compilation and Configuration: <span class="stt">raco</span></h5><p>The <span class="stt">raco</span> (short for “<span style="font-weight: bold">Ra</span>cket <span style="font-weight: bold">co</span>mmand”) program
|
||
|
provides a command-line interface to many additional tools for
|
||
|
compiling Racket programs and maintaining a Racket installation.</p><ul><li><p><span class="stt">raco make</span> compiles Racket source to bytecode.</p><p>For example, if you have a program <span class="stt">"take-over-world.rkt"</span> and
|
||
|
you’d like to compile it to bytecode, along with all of its
|
||
|
dependencies, so that it loads more quickly, then run</p><p><span class="hspace"> </span><span class="stt">raco make take-over-the-world.rkt</span></p><p>The bytecode file is written as <span class="stt">"take-over-the-world_rkt.zo"</span>
|
||
|
in a <span class="stt">"compiled"</span> subdirectory; <a name="(idx._(gentag._10._(lib._scribblings/guide/guide..scrbl)))"></a><span class="stt">".zo"</span>
|
||
|
is the file suffix for a bytecode file.</p></li><li><p><span class="stt">raco setup</span> manages a Racket installation, including
|
||
|
manually installed packages.</p><p>For example, if you create your own library <a href="module-basics.html#%28tech._collection%29" data-pltdoc="x">collection</a>
|
||
|
called <span class="stt">"take-over"</span>, and you’d like to build all bytecode and
|
||
|
documentation for the collection, then run</p><p><span class="hspace"> </span><span class="stt">raco setup take-over</span></p></li><li><p><span class="stt">raco pkg</span> manages <a href="module-basics.html#%28tech._package%29" class="techoutside" data-pltdoc="x"><span class="techinside">package</span></a>s that can be installed
|
||
|
through the Racket package manager.</p><p>For example, to see the list of installed packages run:</p><p><span class="hspace"> </span><span class="stt">raco pkg show</span></p><p>To install a new package named <span class="stt"><package-name></span> run:</p><p><span class="hspace"> </span><span class="stt">raco pkg install <package-name></span></p><p>See <a href="https://download.racket-lang.org/releases/8.6/doc/local-redirect/index.html?doc=pkg&rel=index.html&version=8.6" class="Sq" data-pltdoc="x">Package Management in Racket</a> for more details
|
||
|
about package management.</p></li></ul><p>For more information on <span class="stt">raco</span>, see <a href="https://download.racket-lang.org/releases/8.6/doc/local-redirect/index.html?doc=raco&rel=index.html&version=8.6" class="Sq" data-pltdoc="x"><span class="stt">raco</span>: Racket Command-Line Tools</a>.</p><h5 x-source-module="(lib "scribblings/guide/guide.scrbl")" x-source-pkg="racket-doc" x-part-tag=""Interactive_evaluation"">24.1.2<tt> </tt><a name="(part._.Interactive_evaluation)"></a>Interactive evaluation</h5><p>The Racket REPL provides everything you expect from a modern interactive
|
||
|
environment. For example, it provides an <a href="https://download.racket-lang.org/releases/8.6/doc/local-redirect/index.html?doc=xrepl&rel=index.html%23%2528xrepl._enter%2529&version=8.6" class="plainlink Sq" data-pltdoc="x"><span class="RktInBG"><span class="hspace"></span><span class="RktIn">,enter</span><span class="hspace"></span></span></a> command to have a
|
||
|
REPL that runs in the context of a given module, and an <a href="https://download.racket-lang.org/releases/8.6/doc/local-redirect/index.html?doc=xrepl&rel=index.html%23%2528xrepl._edit%2529&version=8.6" class="plainlink Sq" data-pltdoc="x"><span class="RktInBG"><span class="hspace"></span><span class="RktIn">,edit</span><span class="hspace"></span></span></a> command
|
||
|
to invoke your editor (as specified by the <span class="stt">EDITOR</span> environment
|
||
|
variable) on the file you entered. A <a href="https://download.racket-lang.org/releases/8.6/doc/local-redirect/index.html?doc=xrepl&rel=index.html%23%2528xrepl._drracket%2529&version=8.6" class="plainlink Sq" data-pltdoc="x"><span class="RktInBG"><span class="hspace"></span><span class="RktIn">,drracket</span><span class="hspace"></span></span></a> command makes it easy
|
||
|
to use your favorite editor to write code, and still have DrRacket at hand to
|
||
|
try things out.</p><p>For more information, see <a href="https://download.racket-lang.org/releases/8.6/doc/local-redirect/index.html?doc=xrepl&rel=index.html&version=8.6" class="Sq" data-pltdoc="x">XREPL: eXtended REPL</a>.</p><h5 x-source-module="(lib "scribblings/guide/guide.scrbl")" x-source-pkg="racket-doc" x-part-tag=""Shell_completion"">24.1.3<tt> </tt><a name="(part._.Shell_completion)"></a>Shell completion</h5><p>Shell auto-completion for <span class="stt">bash</span> and <span class="stt">zsh</span> is available in
|
||
|
<span class="stt">"share/pkgs/shell-completion/racket-completion.bash"</span> and
|
||
|
<span class="stt">"share/pkgs/shell-completion/racket-completion.zsh"</span>,
|
||
|
respectively.
|
||
|
To enable it, just run the appropriate file from your <span class="stt">.bashrc</span> or
|
||
|
your <span class="stt">.zshrc</span>.</p><p>The <span class="stt">"shell-completion"</span> collection is only available in the Racket Full
|
||
|
distribution. The completion scripts are also available
|
||
|
<a href="https://github.com/racket/shell-completion">online</a>.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" id="searchbox" type="text" tabindex="1" placeholder="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "8.6", "../");"/></form> <a href="https://docs.racket-lang.org/index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("8.6");">top</a><span class="tocsettoggle"> <a href="javascript:void(0);" title="show/hide table of contents" onclick="TocsetToggle();">contents</a></span></span><span class="navright"> <a href="other-editors.html" title="backward to "24 Command-Line Tools and Your Editor of Choice"" data-pltdoc="x">← prev</a> <a href="other-editors.html" title="up to "24 Command-Line Tools and Your Editor of Choice"" data-pltdoc="x">up</a> <a href="Emacs.html" title="forward to "24.2 Emacs"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|