hg-prompt/documentation/usage/index.html @ a4c5a71394ac
hg-prompt: Update documentation.
author |
Steve Losh <steve@stevelosh.com> |
date |
Fri, 08 Jan 2010 20:11:40 -0500 |
parents |
383887c412c2 |
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> »
<a href="../">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="gp">$</span> hg prompt <span class="s2">"test"</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">"currently on {branch}"</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">"currently on {branch} and at {bookmark}"</span>
<span class="go">currently on branch default and at</span>
<span class="gp">$</span> hg prompt <span class="s2">"currently on {branch} {and at {bookmark}}"</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">"currently on {branch} {and at {bookmark}}"</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">"{currently on {branch}}"</span>
<span class="go">currently on default</span>
<span class="gp">$</span> hg prompt --angle-brackets <span class="s2">"<currently on <branch>>"</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>