docs/wiki/documentation/usage/index.mdown @ d93fe1c921f9

- Add |anyapplied, |anyunapplied, |anycount, and |nondefault filters.
- |anyapplied, |anyunapplied, |anycount, are filters to patch and when applied will make
 change the behavior so that if no patches are present then nothing will be printed
- |nondefault is a filter for branch that will stop anything being printed if the branch
 is the default one.  So only non-default branches are printed.
author Jason Harris <jasonh@wolfram.com>
date Fri, 27 Nov 2009 13:24:49 +0100
parents f9616d40630b
children 187b25ff6e1a
Usage
=====

The `hg prompt` command takes a single string as an argument and outputs it.  Here's a simple (and useless) example:

    :::console
    $ hg prompt "test"
    test

Keywords in curly braces can be used to output repository information:

    :::console
    $ hg prompt "currently on {branch}"
    currently on default

Keywords also have an extended form:

    :::text
    {optional text{branch}more optional text}

This form will output the text and the expanded keyword **only** if the keyword successfully expands.  This can be useful for displaying extra text only if it's applicable:

    :::console
    $ hg prompt "currently on {branch} and at {bookmark}"
    currently on branch default and at 
    
    $ hg prompt "currently on {branch} {and at {bookmark}}"
    currently on branch default 
    
    $ hg bookmark my-book
    
    $ hg prompt "currently on {branch} {and at {bookmark}}"
    currently on branch default and at my-book

Take a look at the [keywords][] documentation to see all the keywords `hg-prompt` supports.

[keywords]: /hg-prompt/documentation/keywords/