hg-prompt/quickstart/index.html @ 9419dfa1bff9
hg-prompt: Update site.
author |
Steve Losh <steve@stevelosh.com> |
date |
Sun, 19 Jul 2020 11:35:39 -0400 |
parents |
abcf6f68470c |
children |
(none) |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Quick Start / hg-prompt</title>
<link rel="stylesheet" href="../_dmedia/tango.css"/>
<link rel="stylesheet/less" type="text/css" href="../_dmedia/style.less"/>
<script src="../_dmedia/less.js" type="text/javascript">
</script>
</head>
<body class="content">
<div class="wrap">
<header><h1><a href="..">hg-prompt</a></h1></header>
<div class="markdown">
<h1 id="quick-start"><a href="">Quick Start</a></h1><p>This guide will get you up and running so you can put some useful information
into your shell prompt.</p>
<p>If you haven't already <a href="../installation/">installed</a> it, do that now.</p>
<div class="toc">
<ul>
<li><a href="#a-simple-but-useful-prompt">A Simple (But Useful) Prompt</a></li>
<li><a href="#an-advanced-prompt">An Advanced Prompt</a></li>
<li><a href="#learn-more">Learn More</a></li>
</ul></div>
<h2 id="a-simple-but-useful-prompt">A Simple (But Useful) Prompt</h2>
<p>Edit your <code>~/.bashrc</code> file to include something like this:</p>
<div class="codehilite"><pre><span/>hg_ps1() {
hg prompt "{ on {branch}}{ at {bookmark}}{status}" 2> /dev/null
}
export PS1='\u at \h in \w$(hg_ps1)\n$ '
</pre></div>
<p><code>source ~/.bashrc</code> after to test it out. Make sure you're in a Mercurial
repository or you won't see anything. This little prompt will give you
something like this:</p>
<div class="codehilite"><pre><span/>steve at myhost in ~/src/hg-prompt on default at feature-bookmark?
$
</pre></div>
<h2 id="an-advanced-prompt">An Advanced Prompt</h2>
<p>How about something a little more interesting?</p>
<div class="codehilite"><pre><span/>hg_ps1() {
hg prompt "{[+{incoming|count}]-->}{root|basename}{/{branch}}{-->[+{outgoing|count}]}{ at {bookmark}}{status}" 2> /dev/null
}
export PS1='$(hg_ps1)\n\u at \h in \w\n$ '
</pre></div>
<p>And the result (this example assumes one incoming changeset and two outgoing):</p>
<div class="codehilite"><pre><span/>[+1]-->hg-prompt/default-->[+2] at feature-bookmark
steve at myhost in ~/src/hg-prompt
$
</pre></div>
<h2 id="learn-more">Learn More</h2>
<p>From here you can take a look at the <a href="../full-documentation/">full documentation</a> to see all the
interesting things <code>hg-prompt</code> can do.</p>
</div>
<footer><p><i>Made by <a href="https://stevelosh.com/">Steve Losh</a>.</i></p>
<p><a href="http://rochestermade.com" title="Rochester Made"><img src="https://rochestermade.com/media/images/rochester-made-dark-on-light.png" alt="Rochester Made" title="Rochester Made"/></a></p></footer>
</div>
</body>
</html>