<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[129060] trunk/base/doc/port-search.1.txt</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/129060">129060</a></dd>
<dt>Author</dt> <dd>cal@macports.org</dd>
<dt>Date</dt> <dd>2014-12-04 12:20:09 -0800 (Thu, 04 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>base: document port search, #44530</pre>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkbasedocportsearch1txt">trunk/base/doc/port-search.1.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbasedocportsearch1txtfromrev129052trunkbasedocportinstalled1txt"></a>
<div class="copfile"><h4>Copied: trunk/base/doc/port-search.1.txt (from rev 129052, trunk/base/doc/port-installed.1.txt) (0 => 129060)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/doc/port-search.1.txt                                (rev 0)
+++ trunk/base/doc/port-search.1.txt        2014-12-04 20:20:09 UTC (rev 129060)
</span><span class="lines">@@ -0,0 +1,160 @@
</span><ins>+// vim: set et sw=4 ts=8 ft=asciidoc tw=80:
+port-search(1)
+==============
+$Id$
+
+NAME
+----
+port-search - Search for a port using keywords
+
+SYNOPSIS
+--------
+[cmdsynopsis]
+*port* [*-dq*] *search*
+     [--case-sensitive] [--line] [--exact|--glob|--regex] [--'field' ...]
+     'keyword' ...
+
+DESCRIPTION
+-----------
+*port search* helps you find ports by partial matches of the name or description
+(or other fields, depending on the given options). It is the tool of choice if
+you are looking for software in MacPorts.
+
+*search* works by searching for your given keyword(s) in a set of fields of all
+available ports. By default, a port's name and short description are searched,
+as if you had specified both *--name* and *--description*. See *OPTIONS* for
+possible values for 'field'.
+
+Note that you can specify multiple fields to be searched. A port will be printed
+when any of the fields matches your keyword(s). If you specify multiple
+keywords, *search* will run multiple separate searches, one for each given
+keyword.
+
+OPTIONS
+-------
+
+Search behavior
+~~~~~~~~~~~~~~~
+
+*--case-sensitive*::
+    Do not ignore case when searching for the given keyword.
+
+*--exact*::
+    Search for the given string exactly. Disables *--glob* (the default) and
+    *--regex*.
+
+*--glob*::
+    Treat the keyword(s) as wildcard (i.e., expand '\*', '?' and '[sets]'). This
+    is the default. See the *string match* section of man:string[n] for
+    a detailed syntax description.
+
+*--regex*::
+    Treat the given string as a Tcl regular expression. See man:re_syntax[n] for
+    a description of Tcl regular expressions.
+
+Output behavior
+~~~~~~~~~~~~~~~
+
+*--line*::
+    Print one match per line, where a line consists of name, version, categories
+    and short description.
+
+See also *-q* in the *GLOBAL OPTIONS* section below.
+
+Field selection
+~~~~~~~~~~~~~~~
+
+*--category*, *--categories*::
+    Search the category. You can use this to list all ports in a given category.
+    For example, *port search --category haskell* will print all Haskell ports
+    in MacPorts. If you don't need the description it's usually faster to use
+    the pseudo-portname selector *category:haskell* with man:port-echo[1] (i.e.,
+    *port echo category:haskell*) instead. See man:port[1] for more information
+    on pseudo-port selectors.
+
+*--depends*, *--depends_build*, *--depends_extract*, *--depends_fetch*, *--depends_lib*, *--depends_run*::
+    Search for ports that depend on the port given as keyword. *--depends* is an
+    alias for all other *--depends_* options combined. Note that only
+    dependencies present in default variants will be found by this search. As
+    with *--category*, there also are pseudo-portname selectors available for
+    dependencies.
+
+*--description*, *--long_description*::
+    Test the search string against ports' descriptions.
+
+*--homepage*::
+    Search for the keyword(s) in the homepage property.
+
+*--maintainer*::
+    Search for ports maintained by a specific maintainer. Note that there also
+    is a pseudo-portname selector available for maintainer addresses. See
+    man:port[1] for more information.
+
+*--name*::
+    Search in ports' names. Since this is the default (together with
+    *--description*), this flag is only useful when you to search 'only' in the
+    name, but not the description.
+
+*--portdir*::
+    Test the search string against the path of the directory that contains the
+    port.
+
+*--variant*, *--variants*::
+    Search for variant names.
+
+include::global-flags.txt[]
+
+*-q*::
+    Only print the name of the port that matched your query. Print one match per
+    line.
+
+EFFICIENT SEARCHING
+-------------------
+The output of *search* can be overwhelming and confusing, especially with
+a large number of results. Here are a few tips to improve your search efficiency
+with MacPorts.
+
+Suppose you are looking for PHP in MacPorts. You might start with
+----
+$&gt; port search php
+----
+and notice your query produces a lot of output. In fact, at the time of writing
+this, this search produces 763 matches. By default, *search* searches both name
+and description of a port. While we're looking for PHP, we can reduce the number
+of hits by using the *--name* flag. Furthermore, we only want ports whose name
+starts with “php”, so we add the *--glob* flag (actually, we could leave it out
+because it is the default) and modify the search term to *php**. Note that the
+asterisk needs to be escaped or quoted to prevent the shell from interpreting
+it:
+----
+$&gt; port search --name --glob 'php*'
+----
+Since that still produces 689 results, we can activate compressed output using
+the *--line* flag
+----
+$&gt; port search --line --name --glob 'php*'
+----
+Scrolling over the output, we see a large number of PHP modules starting with
+php&lt;version&gt;-&lt;modulename&gt;. That tells us the main PHP ports might be named
+php&lt;version&gt;. Using regex we can further narrow down the results:
+----
+$&gt; port search --line --name --regex '^php\d+$'
+----
+
+Note it is not always necessary to drill down to reduce the amount of output.
+For example, if you're looking for *rrdtool*, a popular system to store and
+graph time-series data, the simple approach works well, with only 12 ports being
+returned:
+----
+$&gt; port search rrd
+----
+
+
+SEE ALSO
+--------
+man:port[1], man:string[n], man:re_syntax[n], man:port-install[1]
+
+AUTHORS
+-------
+ (C) 2014 The MacPorts Project
+ Clemens Lang &lt;cal@macports.org&gt;
</ins></span></pre>
</div>
</div>

</body>
</html>