hg-prompt/documentation/usage/index.html @ 50444dfe7265

django-hoptoad: Update documentation.
author Steve Losh <steve@stevelosh.com>
date Sat, 27 Feb 2010 11:14:08 -0500
parents a4c5a71394ac
children abcf6f68470c
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
    "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
      xmlns:dc="http://purl.org/dc/elements/1.1/"
      xmlns:foaf="http://xmlns.com/foaf/0.1/">
  
  <head>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
    
    <title>
      hg-prompt » Usage
    </title>
    
    <link rel="stylesheet" type="text/css" href="../../media/css/reset.css" media="screen, projection" />
    <link rel="stylesheet" type="text/css" href="../../media/css/layout.css" media="screen, projection" />
    <link rel="stylesheet" type="text/css" href="../../media/css/typography.css" media="screen, projection" />
    <link rel="stylesheet" type="text/css" href="../../media/css/pygments.css" media="screen, projection" />
  </head>
  
  <body>
    <div id="content">

      
        <div id="breadcrumbs">
          <p>
              
                
                  <a href="../../">index</a> &#187;
                
              
                
                  <a href="../">documentation</a> &#187;
                
              
                
                  usage
                
              
          </p>
        </div> <!-- div#breadcrumbs -->
      
      
      
  <h1 id="usage">Usage</h1>
<p>The <code>hg prompt</code> command takes a single string as an argument and outputs it.
Here's a simple (and useless) example:</p>
<div class="codehilite"><pre><span class="gp">$</span> hg prompt <span class="s2">&quot;test&quot;</span>
<span class="go">test</span>
</pre></div>


<p>Keywords in curly braces can be used to output repository information:</p>
<div class="codehilite"><pre><span class="gp">$</span> hg prompt <span class="s2">&quot;currently on {branch}&quot;</span>
<span class="go">currently on default</span>
</pre></div>


<p>Keywords also have an extended form:</p>
<div class="codehilite"><pre>{optional text{branch}more optional text}
</pre></div>


<p>This form will output the text and the expanded keyword <strong>only</strong> if the
keyword successfully expands. This can be useful for displaying extra text
only if it's applicable:</p>
<div class="codehilite"><pre><span class="gp">$</span> hg prompt <span class="s2">&quot;currently on {branch} and at {bookmark}&quot;</span>
<span class="go">currently on branch default and at</span>

<span class="gp">$</span> hg prompt <span class="s2">&quot;currently on {branch} {and at {bookmark}}&quot;</span>
<span class="go">currently on branch default</span>

<span class="gp">$</span> hg bookmark my-book

<span class="gp">$</span> hg prompt <span class="s2">&quot;currently on {branch} {and at {bookmark}}&quot;</span>
<span class="go">currently on branch default and at my-book</span>
</pre></div>


<p>You can give the <code>--angle-brackets</code> option to use angle brackets for keywords
instead of curly brackets. This can come in handy when combining a simple
prompt string with more complicated shell functionality (like color
variables):</p>
<div class="codehilite"><pre><span class="gp">$</span> hg prompt <span class="s2">&quot;{currently on {branch}}&quot;</span>
<span class="go">currently on default</span>

<span class="gp">$</span> hg prompt --angle-brackets <span class="s2">&quot;&lt;currently on &lt;branch&gt;&gt;&quot;</span>
<span class="go">currently on default</span>
</pre></div>


<p>Take a look at the <a href="../keywords/">keywords</a> documentation to see all the keywords
<code>hg-prompt</code> supports.</p>

    
      <p id="footer">
        
          hg-prompt —
        
        Powered by <a href="http://bitbucket.org/zacharyvoase/markdoc">Markdoc</a>.
      </p>
    
    </div> <!-- div#content -->
  </body>
</html>