fish: Additional GUESTFISH_* environment variables to control the prompt.

This adds:

 - GUESTFISH_INIT
 - GUESTFISH_OUTPUT
 - GUESTFISH_RESTORE

which along with existing GUESTFISH_PS1 allow you to fine control the
colour of the output.
This commit is contained in:
Richard W.M. Jones
2014-02-03 09:08:12 +01:00
parent bed8a168c0
commit d93e3c50eb
2 changed files with 80 additions and 3 deletions

View File

@@ -1262,7 +1262,14 @@ I<--no-progress-bars>.
You can change or add colours to the default prompt
(C<E<gt>E<lt>fsE<gt>>) by setting the C<GUESTFISH_PS1> environment
variable. A simple prompt can be set by setting this to an alternate
variable. A second string (C<GUESTFISH_OUTPUT>) is printed after the
command has been entered and before the output, allowing you to
control the colour of the output. A third string (C<GUESTFISH_INIT>)
is printed before the welcome message, allowing you to control the
colour of that message. A fourth string (C<GUESTFISH_RESTORE>) is
printed before guestfish exits.
A simple prompt can be set by setting C<GUESTFISH_PS1> to an alternate
string:
$ GUESTFISH_PS1='(type a command) '
@@ -1284,6 +1291,8 @@ A literal backslash character.
=item \]
(These should only be used in C<GUESTFISH_PS1>.)
Place non-printing characters (eg. terminal control codes for colours)
between C<\[...\]>. What this does it to tell the L<readline(3)>
library that it should treat this subsequence as zero-width, so that
@@ -1319,10 +1328,26 @@ The ASCII character whose code is the hex value NN.
Note these these require a terminal that supports ANSI escape codes.
=over 4
=item *
GUESTFISH_PS1='\[\e[1;30m\]><fs>\[\e[0;30m\] '
A bold black version of the ordinary prompt.
=item *
GUESTFISH_PS1='\[\e[1;32m\]><fs>\[\e[0;31m\] '
GUESTFISH_OUTPUT='\e[0;30m'
GUESTFISH_RESTORE="$GUESTFISH_OUTPUT"
GUESTFISH_INIT='\e[1;34m'
Blue welcome text, green prompt, red commands, black command
output.
=back
=head1 WINDOWS 8
Windows 8 "fast startup" can prevent guestfish from mounting NTFS
@@ -1381,6 +1406,14 @@ L</SUPERMIN_KERNEL> and L</SUPERMIN_MODULES>.
The C<display> command uses C<$GUESTFISH_DISPLAY_IMAGE> to
display images. If not set, it uses L<display(1)>.
=item GUESTFISH_INIT
Printed when guestfish starts. See L</PROMPT>.
=item GUESTFISH_OUTPUT
Printed before guestfish output. See L</PROMPT>.
=item GUESTFISH_PID
Used with the I<--remote> option to specify the remote guestfish
@@ -1391,6 +1424,10 @@ L</REMOTE CONTROL GUESTFISH OVER A SOCKET>.
Set the command prompt. See L</PROMPT>.
=item GUESTFISH_RESTORE
Printed before guestfish exits. See L</PROMPT>.
=item HEXEDITOR
The L</hexedit> command uses C<$HEXEDITOR> as the external hex