docs/wiki/documentation/usage/index.mdown @ c4095c3519d6
Fixed bug that was thowing a KeyError when including "{bookmark}" in the output.
This resolves issue #17 (Bookmarks have moved into core for 1.8) on https://bitbucket.org/sjl/hg-prompt/.
The end of the stack track was....
-----------------------------
File "/Users/dak180/Applications/Build/hgExtensions/hg-prompt/prompt.py", line 101, in _bookmark
book = extensions.find('bookmarks').current(repo)
File "/sw/lib/python2.6/site-packages/mercurial/extensions.py", line 30, in find
raise KeyError(name)
KeyError: 'bookmarks'
-----------------------------
I personally was getting this error on mercurial versions 1.8.1 and 1.6.3 (although I am not exactly sure why I got it on 1.6.3).
author |
Shaun Ek <shaune@providentmetals.com> |
date |
Wed, 23 Mar 2011 15:42:04 -0400 |
parents |
4568cfa05d21 |
children |
(none) |
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
You can give the `--angle-brackets` 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):
:::console
$ hg prompt "{currently on {branch}}"
currently on default
$ hg prompt --angle-brackets "<currently on <branch>>"
currently on default
Take a look at the [keywords][] documentation to see all the keywords
`hg-prompt` supports.
[keywords]: /documentation/keywords/