hg-prompt/documentation/usage/index.html @ 310c8feb5645

hg-prompt: Update documentation.
author Steve Losh <steve@stevelosh.com>
date Tue, 15 Dec 2009 19:53:10 -0500
parents 8698c58f4ce2
children 383887c412c2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <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="breadcrumbs">
          <p>
              
                
                  <a href="/">index</a> &#187;
                
              
                
                  <a href="/documentation/">documentation</a> &#187;
                
              
                
                  usage
                
              
          </p>
        </div> <!-- div#breadcrumbs -->
      
      
    <div id="content">
      
      
  <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>Take a look at the <a href="../keywords/">keywords</a> documentation to see all the keywords <code>hg-prompt</code> supports.</p>

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