Welcome to CommandLine
- Copyright © 2005 Jim Freeze
- Author: Jim Freeze
- License
CommandLine is a library that greatly simplifies the repetitive
process of building a command line user interface for your applications.
It's 'ruby-like' usage style streamlines application development so that
even applications with numerous configuration options can be quickly put
together. CommandLine automatically builds friendly usage and help
screens that are nicely formatted for the user. No longer is starting
an application a pain where you have to copy boiler plate code (or a
previous application) and retype repetitive code to get an application started.
CommandLine smartly handles the arguments passed on the commandline.
For example, if your application accepts arguments, and none are given, it prints a usage
statement. But, if your application accepts no arguments, CommandLine will happily
run your application. CommandLine also handles a complex set of
options through the OptionParser library, which is described below.
In addition to these features, CommandLine also ships with the
ability to run system tests on your applications. (Note: It was
recently noticed that the system test infrastructure needs some work
to make it more robust. Anyone willing to help out with this, please
contact me.)
OptionParser is
designed to be a flexible command line parser with a Ruby look and feel to
it. OptionParser got
its birth from the need for a parser that is standards compliant, yet
flexible. OptionParser
supports the standard command line styles of Unix, Gnu
and X Toolkit, but also lets you break those rules.
OptionParser is
not a port of a traditional command line parser, but it is written to meet
the feature requirements of traditional command line parsers. When using it
as a library, you should notice that it is expressive, supports
Ruby’s blocks and lambda’s, and is sprinkled with a little bit
of magic.
While the library can be used by itself, it is also designed to work with
the CommandLine::Application class. These tools work together to
facilitate the generation of a sophisticated (batch oriented) application
user interface in a matter of minutes.
If you need a refresher on the traditional option parsing schemes, see
"Traditional Option Parsing Schemes" below.
CommandLine Usage
Getting Started
Installing
CommandLine is a gem and can be installed using the gem install command:
gem install -r commandline
Loading the library
When using the library, it is loaded as usual with:
require 'rubygems'
require 'commandline'
CommandLine::Application
The CommandLine::Application class is only the class the most
users will need to interact with. This class has many wrappers and convenience
methods that utilize the Option and OptionParser
classes.
Example 1: A very simple application
When you want to test a new library, you usually aren't interested
in handling a vast array of options. You usually want just enough
of a user interface to make some specific calls into your library
too see how it responds. So, the simplist application is one that does
not go out of its way to identify itself and does not take any command
line arguments.
#!/usr/bin/env ruby
require 'rubygems'
require 'commandline'
class App < CommandLine::Application
def main
puts "call your library here"
end
end#class App
To run this app, we just change the mode and launch it:
% chmod 755 myapp
% ./myapp
"call your library here"
Notice that CommandLine does not complain about missing arguments.
It assumes that the number of expected arguments is zero, unless told otherwise.
Standard Options
But an application like this will be useless in about 2 hours when
you have forgotten what it does or how to use it. Let's dress it up
a little by adding a help option. And, since we are probably
going to need to debug this app, let's provide the ability to get
a backtrace when we need it.
#!/usr/bin/env ruby
require 'rubygems'
require 'commandline'
class App < CommandLine::Application
def initialize
options :help, :debug
end
def main
puts "call your library here"
end
end#class App
Now, lets run the app with the help option.
% ./myapp -h
NAME
myapp.rb
OPTIONS
--help,-h
Displays help page.
--debug,-d
Sets debug to true.
Adding Expected Arguments
Ok, that's a little better. Now, let's tell our application that it needs
to accept a filename as an argument. We don't have to name the arguments,
but since there is only one, it is convenient to go ahead and give
it a name. We will call it @file.
We'll also add a synopsis so that we know how to call and use the application.
#!/usr/bin/env ruby
require 'rubygems'
require 'commandline'
class App < CommandLine::Application
def initialize
synopsis "[-dh] file"
expected_args :file # will set instance variable @file to command line argument.
end
def main
puts "#{name} called with #{args.size} arguments: #{args.inspect}"
puts "@file = #{@file}"
end
end#class App
And run it:
% ruby myapp.rb
Usage: myapp.rb [-dh] file
% ruby myapp.rb fred_file
myapp.rb called with 1 arguments: ["fred_file"]
@file = fred_file
You may notice that this application has a new method -- :initialize.
In this method, Since we've added some setup code to our application object, we created an
initialize method and put our code inside it.
(BTW, don't mispell initialize. It can cause real confusion.)
This is where all the
setup takes place for an application. Of course you are free to add other
methods to delegate complex tasks, but it is best if those methods
begin with an underscore '_', as we will see later.
Automatic Running
By the way, if you haven't picked up on it already, notice that
there myapp.rb does not contain any code that explicitly
launches App. This is handled automatically with an
at_exit {...} statement.
If you need to add at_exit handlers in your app, they will
be added during the execution of the built-in at_exit handler.
If this doesn't work for you, then you can always create an application
without the auto run feature.
class App < CommandLine::Application_wo_AutoRun
...
end
(If you have an idea for a better name, please share it with me.)
Adding Options
Most applications take options. These options usually come in two forms:
Flags or Argument Identifiers.
Flags
Option flags simply have a true or false value, depending if they
are present on the command line. You can define your own flags
explicitly:
option :names => %w(--my-flag -m),
opt_description => "Sets my-flag to true"
opt_found => true,
opt_not_found => false
Or, using the :flag shorthand provided by Application
option :flag, :names => %w(--my-flag -m)
Both methods produce the same results.
OPTIONS
--my-flag,-m
Sets --my-flag to true.
Argument Identifiers
More complex options take arguments, and CommandLine does not
place limitations on the argument list like most other option parsers do.
Consider the situtation where you need to indicate a file as a parameter
on the command line. This common case can be done simply with the notation:
option :names => "--file",
opt_found => get_args
And we retrieve the value with:
opt.file # or opt["--file"]
or, more fully
@option_data.file # or @option_data["--file"]
Let's fill this app out a little more completely and look at it in more detail.
#!/usr/bin/env ruby
require 'rubygems'
require 'commandline'
class App < CommandLine::Application
def initialize
author "Author Name"
copyright "Author Name, 2005"
synopsis "[-dh] [--in-file ] file"
short_description "Example application with one arg"
long_description "put your long description here!"
options :help, :debug
option :names => "--in-file", opt_found => get_args,
:opt_description => "Input file for sample app.",
:arg_description => "input_file"
expected_args :file
end
def main
puts "args: #{args}
puts "--in-file: #{opt["--in-file"]}"
end
end#class App
Running this application without any arguments, we get the usage
since it is expecting an argument.
% ./myapp.rb
Usage: myapp.rb [-dh] [--in-file <in_file>] file
But, this may not be clear enough, so let's ask for the help page.
% ./myapp.rb --help
NAME
app_file.rb - Example application with one arg
SYNOPSIS
app_file.rb [-dh] [--in-file ] file
DESCRIPTION
put your long description here!
OPTIONS
--help,-h
Displays help page.
--debug,-d
Sets debug to true.
--in-file input_file
Input file for sample app.
AUTHOR: Author Name
COPYRIGHT (c) Author Name, 2005
Pretty nice for just a small amount of source code.
Now that we know how to use the application, let's call
it with some arguments and options.
% ./myapp.rb file --in-file fred
args: file
--in-file: fred
That's all there is to it.
Replay
If ever there was a nifty little feature for applications that
have large command lines, it is replay.
Replay is not my original idea, but I got it from a company
that I worked for. We had applications that would create
working directories and launch sub applications in those
working directories.
Some of these applications had hundreds
of options. The replay file was useful for those times that these
sub applications had to be launched manually. The .replay
file could be modified if needed, and the app re-launched with
a simple 'app -r' from the commandline.
Activating Replay
Replay is activated by by calling use_replay in your
initialization method.
Replay stores the command line in a .replay file
in the working directory from which the app was launched.
Relaunching the app with -r uses the arguments from the
.replay file, saving typing and mistakes.
Without the -r flag, any existing replay file is overwritten
with the arguments sent to the application. If no arguments
are sent, the .replay file is left untouched.
If the -r flag is provided with other arguments, they are
ignored if @replay is set to true.
#!/usr/bin/env ruby
require 'rubygems'
require 'commandline'
class App < CommandLine::Application
# If use_replay is given, and '-r' is supplied,
# it checks for the existance of a .replay file. If such a file
# exists, the app will use those arguments when run.
# Also, every time the app is run with arguments, the replay file
# is updated.
def initialize
use_replay
expected_args :input, :output
end
def main
p @arg_names
puts "#{name} called with #{@args.size} arguments: #{@args.inspect}"
puts "input: #{@input}"
puts "output: #{@output}"
end
end#class App
Now we run the app:
% ls
myapp.rb
% ./myapp.rb aa bb
[:input, :output]
myapp.rb called with 2 arguments: ["aa", "bb"]
input: aa
output: bb
% ls -A
.replay myapp.rb
% cat .replay
aa bb
And, run it using replay:
% ./myapp.rb -r
[:input, :output]
app_replay.rb called with 2 arguments: ["aa", "bb"]
input: aa
output: bb
To customize your application and options, you can read the next section
for more low level details.
OptionParser Usage
The OptionParser
library consists of three classes, Option, OptionParser and
OptionData. For each option an Option object is created.
When you are ready to prepare for command line parsing, these options are
collected into an array and fed to OptionParser.
This OptionParser
object controls the type of option scheme that is implemented. When it
comes time to parse a command line, call the method Option#parse.
This will parse any array, but parses ARGV by default. The result is an
OptionData object. This object can be used from which to extract
values or it can be passed to another class as a fully encapsulated data
object.
Using Option Parser
An option is created with the following syntax:
opt = Option.new([options], <properties>)
The options can be :flag or :posix. :flag means
that the option is a mode flag and does not take any arguments.
:posix means that Option will validate the properties to
ensure they are posix compliant.
An option object has six properties. Four of these properties define
attributes of the object. The last two define actions that are
taken when a command line is parsed.
- :names
- :arity
- :opt_description
- :arg_description
- :opt_found
- :opt_not_found
It is not necessary to set values for all of these properties. Some are set
automatically, as we’ll see below.
Posix
The default Option object is non-posix.
op1 = OptionParser.new(:posix, opts)
op2 = OptionParser.new(opts)
op1.posix #=> true
op2.posix #=> false
Mode-Flag
To create a mode flag, that is, an option that is either true or false
depending if it is seen on the command line or not, we could write:
opt_debug = Option.new(
:names => %w(--debug -d), # the flag has two names
:arity => [0,0], # this says take no arugments
:opt_description => "Sets debug to true",
:arg_description => "",
:opt_found => true, # true if seen on command line
:opt_not_found => false # false if not seen on command line
)
Now, this is a lot of work just for a common mode-flag. However, there is a
shorter way:
opt = Option.new(:flag, :names => %w(--debug -d))
When Option sees the :flag option, it makes some assignments
behind the scenes and what you are left with is:
:names => ["--debug", "-d"]
:arity => [0, 0]
:opt_description => "Sets debug to true." # debug is taken from the first name
:arg_description => ""
:opt_found => true
:opt_not_found => false
For a common option like a mode-flag, Option will use the first
option ‘word’ it finds in the :names list and use that in the
automatic option text. Of course, if you don’t want any text, just
set the option description to an empty string:
:opt_description => "".
Option Arguments
If an option is not a mode flag, then it takes arguments. Most option
parsers only permit a single argument per option flag. If your application
needs multiple arguments, the standard method is just to repeat the option
multiple times, once for each required argument. For example, if I need to
pass two files to an application I would need something like:
myapp -f file1 -f file2
But, it would be cleaner if the command line could be expressed as:
myapp -f file1 file2
Well, no longer do you have to suffer with thirty-year old option parser
technology. OptionParser
permits multiple arguments per option flag and the number of arguments can
be defined to be variable.
To define an option that takes 1 or more arguments, the following can be
done:
opt = Option.new(:names => "--file", :arity => [1,-1])
Let’s say the option required at least two arguments, but not more
than five. This is defined with:
opt = Option.new(:names => "--file", :arity => [2,5])
OptionParser.new(opt).parse
% myapp --file file1 # exception raised
% myapp --file file1 file2 # ok
% myapp --file file1 file2 file3 # ok
% myapp --file f1 f2 f3 f4 f5 f6 # f6 remains on the command line
This ability is handy on occassions where an option argument is
‘optional’.
myapp --custom # no args, uses $HOME/.myapprc
myapp --custom my_custom_file # uses my_custom_file
This type of option is defined by:
opt = Option.new(:names => "--custom", :arity => [0,1])
If the :arity is not satisfied, an exception is raised.
Actions
The option properties :opt_found and :opt_not_found are
the source of the value returned for an option when it is parsed. These
properties can be either an object or a proc/lambda. If they are an object,
then the stored object is simply returned. If they are lambdas, then the
stored value is the return value of the proc/lambda. So, the following will
have the same result:
opt_debug = Option.new(:flag
:names => %w(--debug -d),
:opt_found => true,
:opt_not_found => false
)
opt_debug = Option.new(:flag
:names => %w(--debug -d),
:opt_found => lambda { true },
:opt_not_found => lambda { false }
)
Notice that there is no need to set an instance variable to a default
value. Normally one does:
@debug = false
# option setup
... parse the commandline
@debug = true if parse_results["--debug"]
But with OptionParser, one
has the capability of doing the following:
opt_debug = Option.new(:flag, :names => %w(--debug -d))
... parse the commandline
@debug = option_data[:debug] # value is set without need for default
# or
opt_debug = Option.new(:flag
:names => %w(--debug -d),
:opt_found => lambda { @debug = true },
:opt_not_found => lambda { @debug = false }
)
# do nothing, variable already set.
I find this much easier to manage than having to worry about setting
default behaviour. Now that we know how to create options, let’s move
on to the commandline parser.
OptionParser
Once the options are defined, we load them into an OptionParser and
parse the command line. The syntax for creating an OptionParser
object is:
OptionParser.new(prop_flags, option)
OptionParser.new(prop_flags, [options])
OptionParser.new(option)
OptionParser.new([options])
where the possible property flags are:
:posix
:unknown_options_action => :collect | :ignore | :raise
If you want to parse posix, you must specify so. OptionParser will
not assume posix mode just because all of the options are posix options.
This allows you to use posix only options but not require the strict
parsing rules.
Below are a few examples of creating an OptionParser
object:
opt = Option.new(:flag, :names => %w(-h))
op1 = OptionParser.new(:posix, opt)
op2 = OptionParser.new(opt)
or
opts = []
opts << Option.new(:flag, :names => %w(--help h))
opts << Option.new(:flag, :names => %w(--debug d))
Options may be added to an OptionParser by
three different methods:
# Options added as arguments during OptionParser construction
op = OptionParser.new(opt1, opt2)
op = OptionParser.new([opt1, opt2])
or
# Options added in a block constructor
op = OptionParser.new { |o| o << opts }
or
# Options added to an existing OptionParser object
op = OptionParser.new
op << opts
Parsing the Command Line
Parsing the command line is as simple as calling #parse:
option_data = op.parse
Printing an Option Summary
A OptionParser with
a complete set of options added to it defines the human interface that your
application presents to a user. Therefore, the parser should be able to
provide a nicely formatted summary for the user.
An example is shown below with its corresponding output:
require 'rubygems'
require 'commandline/optionparser'
include CommandLine
puts OptionParser.new { |o|
o << Option.new(:flag, :names => %w[--debug -d])
o << Option.new(:flag, :names => %w[--help -h],
:opt_description => "Prints this page.")
o << Option.new(:names => %w[--ouput -o],
:opt_description => "Defines the output file.",
:arg_description => "output_file")
o << Option.new(:names => %w[--a-long-opt --with-many-names -a -A],
:arity => [2,-1],
:opt_description => "Your really long description here.",
:arg_description => "file1 file2 [file3 ...]")
}.to_s
Generates the output:
OPTIONS
--debug,-d
Sets debug to true.
--help,-h
Prints this page.
--ouput,-o output_file
Defines the output file.
--a-long-opt,--with-many-names,-a,-A file1 file2 [file3 ...]
Your really long description here.
Option Data
The OptionData is the return value of OptionParser#parse.
The parsing results for each option are accessed with the bracket notation
#[].
opt = Option.new(:posix,
:names => %w(-r),
:opt_found => OptionParser::GET_ARGS)
od = OptionParser.new(:posix, opt).parse(["-rubygems"])
od["-r"] #=> "ubygems"
od = OptionParser.new(:posix, opt).parse(["-r", "ubygems"])
od["-r"] #=> "ubygems"
OptionData behaves similar to a hash object in that the parsed
option data is accessed with #[] where the key is the first item in the
:names array of each option. An option cannot access its parsed values
using just any of its names.
od = OptionParser.new { |o|
o << Option.new(:flag, :names => %w(--valid --notvalid))
o << Option.new(:flag, :names => %w(--first --second))
}.parse(%w(--notvalid --second))
od["--valid"] #=> true
od["--first"] #=> true
od["--notvalid"] #=> CommandLine::OptionData::UnknownOptionError
od["--second"] #=> CommandLine::OptionData::UnknownOptionError
Built-in Data Handlers
OptionParser has
built-in data handlers for handling common scenarios. These lambdas can
save a lot of typing.
GET_ARG_ARRAY
This is useful for options that take a variable number of arguments. It
returns all the arguments in an array.
# GET_ARG_ARRAY returns all arguments in an array, even if no
# arguments are present. This is not to be confused with the option
# occuring multiple times on the command line.
opt = Option.new(:names => %w(--file),
:argument_arity => [0,-1],
:opt_found => OptionParser::GET_ARG_ARRAY)
#:opt_found => :collect) # would this be better?
od = OptionParser.new(opt).parse(%w(--file))
od["--file"] #=> []
od = OptionParser.new(opt).parse(%w(--file=file))
od["--file"] #=> ["file"]
od = OptionParser.new(opt).parse(%w(--file=file1 --file file2))
od["--file"] #=> ["file2"]
od = OptionParser.new(opt).parse(%w(--file=file1 file2))
od["--file"] #=> ["file1", "file2"]
od = OptionParser.new(opt).parse(%w(--file file1 file2))
od["--file"] #=> ["file1", "file2"]
GET_ARGS
This is a ‘smart’ option getter. If no arguments are found, it
returns true. If a single argument is found, it returns that argument. If
more than one argument is found, it returns an array of those arguments.
opt = Option.new(:names => %w(--file),
:argument_arity => [0,-1],
:opt_found => OptionParser::GET_ARGS)
#:opt_found => :smart_collect) # would this be better?
od = OptionParser.new(opt).parse(%w(--file))
od["--file"] #=> true
od = OptionParser.new(opt).parse(%w(--file=file))
od["--file"] #=> "file"
od = OptionParser.new(opt).parse(%w(--file=file1 --file file2))
od["--file"] #=> "file2"
od = OptionParser.new(opt).parse(%w(--file=file1 file2))
od["--file"] #=> ["file1", "file2"]
od = OptionParser.new(opt).parse(%w(--file file1 file2))
od["--file"] #=> ["file1", "file2"]
And, for those oxymoronic non-optional options:
opt = Option.new(:names => %w(--not-really-an-option),
:opt_not_found => OptionParser::OPT_NOT_FOUND_BUT_REQUIRED
)
OptionParser.new(opt).parse([]) #=> OptionParser::MissingRequiredOptionError
OptionData
We have just shown that after parsing a command line, the result of each
option is found from OptionData. The values that remain on the command line
are assigned to args. Other attributes of OptionData are:
od.argv # the original command line
od.unknown_options # If OptionParser was told to :collect unknown options
od.args # arguments not claimed by any option
od.not_parsed # arguments following a '--' on the command line
od.cmd # not yet implemented - but a cvs like command
Traditional Option Parsing Schemes
This section is a brief overview of traditional command line parsing.
Command line options traditionally occur in three flavors:
- Unix (or POSIX.2)
- Gnu
- X Toolkit
Below is a summary of these schemes. (Note: I did not invent these
traditional parsing conventions. Most of the information contained below
was pulled from internet resources and I have quoted these resources where
possible.)
Unix Style (POSIX)
The Unix style command line options are a single character preceded by a
single dash (hyphen character). In general, lowercase options are preferred
with their uppercase counterparts being the special case variant.
Mode Flag
If an option does not take an argument, then it is a mode-flag.
Optional Separation Between the Option Flag and Its Argument
If the option takes an argument, the argument follows it with optional
white space separating the two. For example, the following forms are both
valid:
sort -k 5
sort -k5
Grouping
A mode-flag can be grouped together with other mode-flags behind a single
dash. For example:
tar -c -v -f
is equivalent to:
tar -cvf
If grouping is done, the last option in a group can be an option that takes
an argument. For example
sort -r -n -k 5
can be written as
sort -rnk 5
but not
sort -rkn 5
because the ‘5’ argument belongs to the ‘k’ option
flag.
Option Parsing Termination
It is convention that a double hyphen is a signal to stop option
interpretation and to read the remaining statements on the command line
literally. So, a command such as:
app -- -x -y -z
will not ‘see’ the three mode-flags. Instead, they will be
treated as arguments to the application:
#args = ["-x", "-y", "-z"]
POSIX Summary
- An option is a hyphen followed by a single alphanumeric character.
- An option may require an argument which must follow the option with an
optional space in between.
-r ubygems
-rubygems
-r=ubygems # not ok. '=' is Gnu style
- Options that do not require arguments can be grouped after a hyphen.
- Options can appear in any order.
- Options can appear multiple times.
- Options precede other nonoption arguments. TODO: Test for this
- The — argument terminates options.
- The - option is used to represent the standard input stream.
References
www.mkssoftware.com/docs/man1/getopts.1.asp
Gnu Style
The Gnu style command line options provide support for option words (or
keywords), yet still maintain compatibility with the Unix style options.
The options in this style are sometimes referred to as
long_options and the Unix style options as short_options.
The compatibility is maintained by preceding the long_options with
two dashes. The option word must be two or more characters.
Separation Between the Option Flag and Its Argument
Gnu style options cannot be grouped. For options that have an argument, the
argument follows the option with either whitespace or an ’=’.
For example, the following are equivalent:
app --with-optimizer yes
app --with-optimizer=yes
Option Parsing Termination
Similar to the Unix style double-hyphen ’- -’, the
Gnu style has a triple-hyphen ’- - -’ to signal that
option parsing be halted and to treat the remaining text as arguments (that
is, read literally from the command line)
app --- -x -y -z
args = ["-x", "-y", "-z"]
Mixing Gnu and Unix Styles
The Gnu and the Unix option types can be mixed on the
same commandline. The following are equivalent:
app -a -b --with-c
app -ab --with-c
app -ba --with-c
app --with-c -ab
X Toolkit Style
The X Toolkit style uses the single hyphen followed by a keyword option.
This style is not compatible with the Unix or the Gnu
option types. In most situations this is OK since these options will be
filtered from the command line before passing them to an application.
’-’ and STDIN
It is convention that a bare hypen indicates to read from stdin.
The OptionParser Style
The CommandLine::OptionParser does not
care what style you use. It is designed for maximum flexiblity so it may be
used within any organiziation to meet their standards.
Multiple Option Names
OptionParser does
not place restrictions on the number of options. The only restriction is
that an option name begin with a hyphen ’-’. A definitely
conjured example of this freedom is:
:names => %w(
--file --File --f --F -file -File -f -F
)
Prefix Matching
Although not encouraged, some prefer the ability to truncate option words
to their first unique match. For example, an application that support this
style and accepts the following two option words:
["--foos", "--fbars"]
will accept any of the following as valid options
app --fo
app --foo
app --foos
for the "—foos" option flag since it can be determined that
"—fo" will only match "—foos" and not
"—fbars".
Repeated Arguments
A common question is how an option parser should respond when an option is
specified on the command line multiple times. This is true for mode flags,
but especially true for options that require an argument, For example, what
should happen when the following is given:
app -f file1 -f file2
Should the parser flag this as an error or should it accept both arguments.
OptionParser gives
you the choice of whether it raises an exception when an option is seen
more than once, or it just passes the data onto the user.
How the data is handled is up to the user, but it typically boils down to
either Append, Replace or Raise. This is described in more detail in the
usage section.
CVS Mode
CVS is a common application with a unique command line structure. The cvs
application commandline can be given options, but requires a command. This
command can also be given options. This means that there are two sets of
options, one set for the cvs application and one set for the cvs-command.
Some example formats are:
cvs [cvs-options]
cvs [cvs-options] command [command-options-and-arguments]
cvs -r update
cvs -r update .
cvs edit -p file
To handle this, the first unclaimed argument is treated as a command and
the options and option-arguments that follow belong to that command. More
on how this is handled in the usage section.
Option Grouping
A conflict can occur where a grouping of single letter Unix options has the
value as a word option preceded by a single dash. For this reason, it is
customary to use the double-dash notation for word options. Unless
double-dashes are enforced for word options, OptionParser will
check for possible name conflicts and raise an exception if it finds one.
|