NAME
bosh - Browsable Output SHellSYNOPSIS
bosh [OPTIONS] [CONFIGURATION] [CONFIGURATION OPTIONS]DESCRIPTION
bosh takes the output of a program or script and provides a curses interface to browse that output. A particular line of that output can be selected and actions can be defined and executed and make use of the that selected line.USAGE
CONFIGURATION is the name of a bosh configuration file (see below), in which case that is loaded.OPTIONS
- -h / --help
- show help and exit
- -v / --version
- show version and exit
- --autorefresh=N
- Automatically re-run command every N seconds.
- --cursorsize=N
- Set the cursor to N lines high.
- --cursormovement=N
- Set how much the cursor moves one an up/down keypress.
- --header=[N]
- Prevent the cursor from entering the first N rows of the output.
- --multilineseperator=STRING
- When an action is invoked and the cursor is multi-line, the lines selected will be concatenated together. With this setting a separating string can be specified to be inserted between the lines.
- --preaction=COMMANDS
- A command or commands that will be run on the invocation of all actions, before the action is run. This allows code that is a common for the actions to be only defined once. Preactions are simply prefixed onto the action when the action is invoked. This means you will need to include a separating character (eg ;) at the end of preaction.
- --refresh=[0,1]
- A value of 1 means that bosh will re-run the command after an action is performed.
- --uservars=N
- Set the number of user variables ( of the form $BOSHVARx ) available. See the USER VARIABLES section below.
CONFIGURATION FILES
Bosh configs are fairly simple. Firstly you need a line which tells bosh the actual program to execute to show it it's buffer -command=ps x
command=for i in *; do echo $i;
done
command=for i in * \
do
\
echo $i
\
done
command{{
for i in
*
do
echo
$i
done
}}
command=ps $*
command=if [ -z "$1" ] \
BOSHERR="usage: $BOSHCONF [SECTION] NAME" \
return 1 \
then
\
BOSHERR="usage: $BOSHCONF [SECTION] NAME" \
return 1 \
fi
\
man
$*
header=4
refresh=1
ACTIONS
Basic actions are defined as -KEY=command
k=kill $(echo $BOSH | cut -f1 -d' ')
9=kill -9 $(echo $BOSH | cut -f1 -d' ')
preaction=PID=$(echo $BOSH | cut -f1 -d'
');
k=kill $PID
9=kill -9 $PID
ACTIONS WITH OUTPUT
For basic actions such as kill, which has no output to stdout, the above definition is sufficient. However, bosh can now intercept the output of actions and place that in the bosh window. These are defined as follows -KEY=[.]command
Or,
l=[.]/usr/sbin/lsof -p $PID
KEY=[>]command
KEY=[!]command
e=[!]pico $BOSH
ACTION PARAMETERS
Actions can now have a prompt for user input before performing the action. The value is available to the action using the $BOSHPARAM variable.s=[!:signal] kill -s $BOSHPARAM
$PID
BOSH* VARIABLES:
In addition to $BOSH , $BOSHPARAM and $BOSHERR (all explained above), the following variables available to actions -- $BOSHPID
- Process ID of bosh itself
- $BOSHPPID
- Parent process ID of bosh (eg: the shell you ran bosh from)
USER VARIABLES
User variables are variables to be set and used by commands and actions. They are of the form $BOSHVARx. When the command or action is run and sets a user variable, bosh will store the contents when that command or action has finished. This allows the values to be used by subsequent actions. To make use of these, you must first set the uservars to the number you need (eg: uservars=1 will give you BOSHVAR1, uservars=10 will give you BOSHVAR1 thru BOSHVAR10).SHELLS
Currently bosh only supports bash as the shell that it spawns for executing the commands and actions. Support for other shells and languages will hopefully be included in the future.EXAMPLE CONFIGURATION:
Included with bosh should be a simple configuration named bops. It uses ps as the main command, and allows you to kill the selected process or view its open files (using lsof). This is where the above examples are taken from. The original inspiration for bosh was being able to kill processes easily in this manner.$ ./bops
$ ./bosh ./bops
KEYS
- UP/DOWN
- cursor up/down
- LEFT/RIGHT
- buffer forward/back
- ^L
- refresh screen
- ^O
- run new command
- ^P
- pipe buffer through a command, with the output of that pipe will become the buffer
- ^R
- refresh program output (re-run the command)
- ^V
- show the current configuration
- ^W
- search
- ^N
- repeat search
- ^X
- exit
- F3
- same as ^W
- F4
- same as ^N
- F5
- same as ^R
- F6
- reload configuration
- F12
- same as ^L
- |
- same as ^P
STATUS BAR
The status bar contains some further information about the current configuration. It shows with exit=num the last exit value of a command run in bosh. Furthermore a R indicates that bosh is running with refresh option activated. In the status bar there will be a countdown shown if the autorefresh option is set.AUTHOR
Alex Sisson ([email protected])HOMEPAGE
Check for updates at http://bosh.sourceforge.net18-MAR-2008 | bosh-0.6 |