portless is a small shell script which lets FreeBSD users quickly browse

port descriptions given the port's name or a glob. Basically to view
the descriptions of GCC (related) ports you type
	portless gcc\*
and portless will display the descriptions of all gcc* ports.
There are options to display the postinstall messages or Makefiles instead.

- Martin Kammerhofer
   mkamm@gmx.net

PR:		ports/98739
Submitted by:	Martin Kammerhofer
This commit is contained in:
Erwin Lansing 2006-06-11 09:43:46 +00:00
parent 3e82ea7898
commit 1901427f77
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=165086
9 changed files with 479 additions and 0 deletions

View File

@ -381,6 +381,7 @@
SUBDIR += pointless
SUBDIR += porteasy
SUBDIR += portell
SUBDIR += portless
SUBDIR += posixtestsuite
SUBDIR += projectionlib
SUBDIR += proxyper

30
misc/portless/Makefile Normal file
View File

@ -0,0 +1,30 @@
# New ports collection makefile for: portless
# Date created: 8 June 2006
# Whom: Martin Kammerhofer
#
# $FreeBSD$
#
PORTNAME= portless
PORTVERSION= 0.1
CATEGORIES= misc
MASTER_SITES= # empty
DISTFILES= # none
EXTRACT_ONLY= # empty
MAINTAINER= mkamm@gmx.net
COMMENT= Quick display of files inside the FreeBSD ports tree
RUN_DEPENDS= less:${PORTSDIR}/sysutils/less
NO_BUILD= yes
MAN1= portless.1
MANCOMPRESSED= no
PLIST_FILES= bin/portless
do-install:
${INSTALL_SCRIPT} ${FILESDIR}/portless.sh ${PREFIX}/bin/portless
${INSTALL_MAN} ${FILESDIR}/portless.1 ${PREFIX}/man/man1
.include <bsd.port.mk>

View File

@ -0,0 +1,108 @@
.\" Copyright (c) 2006 Martin Kammerhofer
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)portless.1,v 1.1 2006/06/08 10:10:56 martin Exp
.\"
.\" Note: The date here should be updated whenever a non-trivial
.\" change is made to the manual page.
.Dd June 8, 2006
.Dt PORTLESS 1
.Os
.Sh NAME
.Nm portless
.Nd "quickly browse port descriptions"
.Sh SYNOPSIS
.Nm
.Op Fl dfiMmp
.Op Fl P Ar pager
.Ar portglob...
.Sh DESCRIPTION
.Nm
lets FreeBSD users quickly browse port descriptions given the port's
name or a (shell type) glob.
.Pp
The options are as follows:
.Bl -tag -width ".Fl P Ar pager"
.It Fl d
Display the
.Pa pkg-descr
file of the port. This is the default.
.It Fl f
Take the
.Ar portglob
argument literal (not as a shell glob).
.It Fl i
Display the
.Pa distinfo
file of the port.
.It Fl M
Display the
.Pa Makefile
file of the port.
.It Fl m
Display the
.Pa pkg-message
file of the port.
.It Fl p
Display the
.Pa pkg-plist
file of the port.
.It Fl P Ar pager
Use the
.Ar pager
program to display the files rather than the program specified by the
.Ev PAGER
environment variable or the default of
.Dq Pa less -e
\&.
.El
.Sh ENVIRONMENT
The
.Nm
command uses the
.Ev PORTSDIR
(default:
.Pa /usr/ports
) and the
.Ev PAGER
(default:
.Dq Pa less -e
) environment variables.
.Sh FILES
.Bl -tag -width ".Pa /usr/ports/*/*/*" -compact
.It Pa /usr/ports/*/*/*
.El
.Sh EXAMPLES
The following is an example of a typical usage
of the
.Nm
command:
.Pp
.Dl "portless gcc\e*"
.Sh AUTHOR
The
.Nm
utility and this manual page were written by
.An Martin Kammerhofer Aq mkamm@gmx.net .
.\" EOF

View File

@ -0,0 +1,92 @@
#! /bin/sh --
# (X)Emacs: -*- mode: Shell-Script; coding: iso8859-1; -*-
# @(#)portless.sh,v 1.3 2006/06/08 10:10:56 martin Exp
# Show "pkg-descr" file of matching port(s).
#
# Copyright (c) 2006 Martin Kammerhofer <mkamm@gmx.net>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
Script=`basename $0` # name of this script
# set defaults
opt_f=""
PORTSDIR=${PORTSDIR:-/usr/ports}
PAGER=${PAGER=$:-less -e}
PKGDESCR="pkg-descr"
# print usage message to stderr and exit
usage()
{
while [ $# != 0 ]; do
echo >&2 "$Script: $1"
shift
done
echo >&2 "usage: $Script [-dfiMmp] [-P pager] 'portglob'..."
exit 64 # EX_USAGE
}
# process options
while getopts "D:dfiMmpP:" option
do
case "$option" in
(D) PORTSDIR="$OPTARG";;
(d) PKGDESCR="pkg-descr";;
(f) opt_f="f";;
(i) PKGDESCR="distinfo";;
(M) PKGDESCR="Makefile";;
(m) PKGDESCR="pkg-message";;
(p) PKGDESCR="pkg-plist";;
(P) PAGER="$OPTARG";;
(*) usage;;
esac
done
shift $(($OPTIND - 1))
# there must be at least one argument
if [ $# = 0 ]; then
usage
fi
# main
for p in "$@"; do
case "$p" in
(*/*/*)
usage "portglob '$p' contains more than one slash!";;
(*/*)
if [ -n "$opt_f" ]; then
$PAGER "$PORTSDIR/$p/$PKGDESCR"
else
$PAGER "$PORTSDIR"/$p/"$PKGDESCR"
fi;;
(*)
if [ -n "$opt_f" ]; then
$PAGER "$PORTSDIR"/[a-z]*/"$p/$PKGDESCR"
else
$PAGER "$PORTSDIR"/[a-z]*/$p/"$PKGDESCR"
fi;;
esac
done
#EOF#

9
misc/portless/pkg-descr Normal file
View File

@ -0,0 +1,9 @@
portless is a small shell script which lets FreeBSD users quickly browse
port descriptions given the port's name or a glob. Basically to view
the descriptions of GCC (related) ports you type
portless gcc\*
and portless will display the descriptions of all gcc* ports.
There are options to display the postinstall messages or Makefiles instead.
- Martin Kammerhofer
mkamm@gmx.net

View File

@ -0,0 +1,30 @@
# New ports collection makefile for: portless
# Date created: 8 June 2006
# Whom: Martin Kammerhofer
#
# $FreeBSD$
#
PORTNAME= portless
PORTVERSION= 0.1
CATEGORIES= misc
MASTER_SITES= # empty
DISTFILES= # none
EXTRACT_ONLY= # empty
MAINTAINER= mkamm@gmx.net
COMMENT= Quick display of files inside the FreeBSD ports tree
RUN_DEPENDS= less:${PORTSDIR}/sysutils/less
NO_BUILD= yes
MAN1= portless.1
MANCOMPRESSED= no
PLIST_FILES= bin/portless
do-install:
${INSTALL_SCRIPT} ${FILESDIR}/portless.sh ${PREFIX}/bin/portless
${INSTALL_MAN} ${FILESDIR}/portless.1 ${PREFIX}/man/man1
.include <bsd.port.mk>

View File

@ -0,0 +1,108 @@
.\" Copyright (c) 2006 Martin Kammerhofer
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)portless.1,v 1.1 2006/06/08 10:10:56 martin Exp
.\"
.\" Note: The date here should be updated whenever a non-trivial
.\" change is made to the manual page.
.Dd June 8, 2006
.Dt PORTLESS 1
.Os
.Sh NAME
.Nm portless
.Nd "quickly browse port descriptions"
.Sh SYNOPSIS
.Nm
.Op Fl dfiMmp
.Op Fl P Ar pager
.Ar portglob...
.Sh DESCRIPTION
.Nm
lets FreeBSD users quickly browse port descriptions given the port's
name or a (shell type) glob.
.Pp
The options are as follows:
.Bl -tag -width ".Fl P Ar pager"
.It Fl d
Display the
.Pa pkg-descr
file of the port. This is the default.
.It Fl f
Take the
.Ar portglob
argument literal (not as a shell glob).
.It Fl i
Display the
.Pa distinfo
file of the port.
.It Fl M
Display the
.Pa Makefile
file of the port.
.It Fl m
Display the
.Pa pkg-message
file of the port.
.It Fl p
Display the
.Pa pkg-plist
file of the port.
.It Fl P Ar pager
Use the
.Ar pager
program to display the files rather than the program specified by the
.Ev PAGER
environment variable or the default of
.Dq Pa less -e
\&.
.El
.Sh ENVIRONMENT
The
.Nm
command uses the
.Ev PORTSDIR
(default:
.Pa /usr/ports
) and the
.Ev PAGER
(default:
.Dq Pa less -e
) environment variables.
.Sh FILES
.Bl -tag -width ".Pa /usr/ports/*/*/*" -compact
.It Pa /usr/ports/*/*/*
.El
.Sh EXAMPLES
The following is an example of a typical usage
of the
.Nm
command:
.Pp
.Dl "portless gcc\e*"
.Sh AUTHOR
The
.Nm
utility and this manual page were written by
.An Martin Kammerhofer Aq mkamm@gmx.net .
.\" EOF

View File

@ -0,0 +1,92 @@
#! /bin/sh --
# (X)Emacs: -*- mode: Shell-Script; coding: iso8859-1; -*-
# @(#)portless.sh,v 1.3 2006/06/08 10:10:56 martin Exp
# Show "pkg-descr" file of matching port(s).
#
# Copyright (c) 2006 Martin Kammerhofer <mkamm@gmx.net>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
Script=`basename $0` # name of this script
# set defaults
opt_f=""
PORTSDIR=${PORTSDIR:-/usr/ports}
PAGER=${PAGER=$:-less -e}
PKGDESCR="pkg-descr"
# print usage message to stderr and exit
usage()
{
while [ $# != 0 ]; do
echo >&2 "$Script: $1"
shift
done
echo >&2 "usage: $Script [-dfiMmp] [-P pager] 'portglob'..."
exit 64 # EX_USAGE
}
# process options
while getopts "D:dfiMmpP:" option
do
case "$option" in
(D) PORTSDIR="$OPTARG";;
(d) PKGDESCR="pkg-descr";;
(f) opt_f="f";;
(i) PKGDESCR="distinfo";;
(M) PKGDESCR="Makefile";;
(m) PKGDESCR="pkg-message";;
(p) PKGDESCR="pkg-plist";;
(P) PAGER="$OPTARG";;
(*) usage;;
esac
done
shift $(($OPTIND - 1))
# there must be at least one argument
if [ $# = 0 ]; then
usage
fi
# main
for p in "$@"; do
case "$p" in
(*/*/*)
usage "portglob '$p' contains more than one slash!";;
(*/*)
if [ -n "$opt_f" ]; then
$PAGER "$PORTSDIR/$p/$PKGDESCR"
else
$PAGER "$PORTSDIR"/$p/"$PKGDESCR"
fi;;
(*)
if [ -n "$opt_f" ]; then
$PAGER "$PORTSDIR"/[a-z]*/"$p/$PKGDESCR"
else
$PAGER "$PORTSDIR"/[a-z]*/$p/"$PKGDESCR"
fi;;
esac
done
#EOF#

View File

@ -0,0 +1,9 @@
portless is a small shell script which lets FreeBSD users quickly browse
port descriptions given the port's name or a glob. Basically to view
the descriptions of GCC (related) ports you type
portless gcc\*
and portless will display the descriptions of all gcc* ports.
There are options to display the postinstall messages or Makefiles instead.
- Martin Kammerhofer
mkamm@gmx.net