hg-prompt/documentation/usage.html @ 564bb9e02ce7
hg-prompt: Update documentation.
author |
Steve Losh <steve@stevelosh.com> |
date |
Thu, 19 Nov 2009 21:33:51 -0500 |
parents |
cf9d11b07810 |
children |
(none) |
<?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="/hg-prompt/media/css/reset.css" media="screen, projection" />
<link rel="stylesheet" type="text/css" href="/hg-prompt/media/css/layout.css" media="screen, projection" />
<link rel="stylesheet" type="text/css" href="/hg-prompt/media/css/typography.css" media="screen, projection" />
<link rel="stylesheet" type="text/css" href="/hg-prompt/media/css/pygments.css" media="screen, projection" />
</head>
<body>
<div id="content">
<div id="breadcrumbs">
<p>
<a href="/hg-prompt/">index</a> »
<a href="/hg-prompt/documentation/">documentation</a> »
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="nv">$</span> <span class="nv">hg</span> <span class="n">prompt</span> <span class="s">"test"</span>
<span class="n">test</span>
</pre></div>
<p>Keywords in curly braces can be used to output repository information:</p>
<div class="codehilite"><pre><span class="nv">$</span> <span class="nv">hg</span> <span class="n">prompt</span> <span class="s">"currently on {branch}"</span>
<span class="n">currently</span> <span class="n">on</span> <span class="n">default</span>
</pre></div>
<p>Keywords also have an extended form:</p>
<div class="codehilite"><pre><span class="p">{</span><span class="n">optional</span> <span class="n">text</span><span class="p">{</span><span class="n">branch</span><span class="p">}</span><span class="n">more</span> <span class="n">optional</span> <span class="n">text</span><span class="p">}</span>
</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="nv">$</span> <span class="nv">hg</span> <span class="n">prompt</span> <span class="s">"currently on {branch} and at {bookmark}"</span>
<span class="n">currently</span> <span class="n">on</span> <span class="n">branch</span> <span class="n">default</span> <span class="ow">and</span> <span class="n">at</span>
<span class="nv">$</span> <span class="nv">hg</span> <span class="n">prompt</span> <span class="s">"currently on {branch} {and at {bookmark}}"</span>
<span class="n">currently</span> <span class="n">on</span> <span class="n">branch</span> <span class="n">default</span>
<span class="nv">$</span> <span class="nv">hg</span> <span class="n">bookmark</span> <span class="k">my</span><span class="o">-</span><span class="n">book</span>
<span class="nv">$</span> <span class="nv">hg</span> <span class="n">prompt</span> <span class="s">"currently on {branch} {and at {bookmark}}"</span>
<span class="n">currently</span> <span class="n">on</span> <span class="n">branch</span> <span class="n">default</span> <span class="ow">and</span> <span class="n">at</span> <span class="k">my</span><span class="o">-</span><span class="n">book</span>
</pre></div>
<p>Take a look at the <a href="/hg-prompt/documentation/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>