hg-prompt/quickstart.html @ 7b4c79521755

hg-prompt: Update documentation.
author Steve Losh <steve@stevelosh.com>
date Thu, 19 Nov 2009 21:35:21 -0500
parents 564bb9e02ce7
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 ยป Quick Start
    </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> &#187;
                
              
                
                  quickstart
                
              
          </p>
        </div> <!-- div#breadcrumbs -->
      
      
      
  <h1 id="quick-start">Quick Start</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="/hg-prompt/installation/">installed</a> it, do that now.</p>
<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 class="n">hg_ps1</span><span class="p">()</span> <span class="p">{</span>
    <span class="n">hg</span> <span class="n">prompt</span> <span class="s">&quot;{ on {branch}}{ at {bookmark}}{status}&quot;</span> <span class="mi">2</span><span class="o">&gt;</span> <span class="sr">/dev/</span><span class="n">null</span>
<span class="p">}</span>

<span class="n">export</span> <span class="n">PS1</span><span class="o">=</span><span class="s">&#39;\u at \h in \w$(hg_ps1)\n$ &#39;</span>
</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 class="n">steve</span> <span class="n">at</span> <span class="n">myhost</span> <span class="n">in</span> <span class="o">~</span><span class="sr">/src/</span><span class="n">hg</span><span class="o">-</span><span class="n">prompt</span> <span class="n">on</span> <span class="n">default</span> <span class="n">at</span> <span class="n">feature</span><span class="o">-</span><span class="n">bookmark</span><span class="p">?</span>
<span class="nv">$</span>
</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 class="n">hg_ps1</span><span class="p">()</span> <span class="p">{</span>
    <span class="n">hg</span> <span class="n">prompt</span> <span class="s">&quot;{[+{incoming|count}]--&gt;}{root|basename}{/{branch}}{--&gt;[+{outgoing|count}]}{ at {bookmark}}{status}&quot;</span> <span class="mi">2</span><span class="o">&gt;</span> <span class="sr">/dev/</span><span class="n">null</span>
<span class="p">}</span>

<span class="n">export</span> <span class="n">PS1</span><span class="o">=</span><span class="s">&#39;$(hg_ps1)\n\u at \h in \w\n$ &#39;</span>
</pre></div>


<p>And the result (this example assumes one incoming changeset and two outgoing):</p>
<div class="codehilite"><pre><span class="p">[</span><span class="o">+</span><span class="mi">1</span><span class="p">]</span><span class="o">--&gt;</span><span class="n">hg</span><span class="o">-</span><span class="n">prompt</span><span class="o">/</span><span class="n">default</span><span class="o">--&gt;</span><span class="p">[</span><span class="o">+</span><span class="mi">2</span><span class="p">]</span> <span class="n">at</span> <span class="n">feature</span><span class="o">-</span><span class="n">bookmark</span>
<span class="n">steve</span> <span class="n">at</span> <span class="n">myhost</span> <span class="n">in</span> <span class="o">~</span><span class="sr">/src/</span><span class="n">hg</span><span class="o">-</span><span class="n">prompt</span>
<span class="nv">$</span>
</pre></div>


<h2 id="learn-more">Learn More</h2>
<p>From here you can take a look at the <a href="/hg-prompt/documentation/">full documentation</a> to see all the interesting things <code>hg-prompt</code> can do.</p>

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