Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jun 2006 12:58:10 +0200
From:      Martin Kammerhofer <dada@pluto.tugraz.at>
To:        freebsd-bugs@FreeBSD.org
Cc:        dada@sbox.tugraz.at
Subject:   ports/98739: New port: misc/portless get port descriptions w/o much typing
Message-ID:  <200606081058.k58AwAI5021088@pluto.tugraz.at>
Resent-Message-ID: <200606090720.k597KJSv009199@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         98739
>Category:       ports
>Synopsis:       New port: misc/portless get port descriptions w/o much typing
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 09 07:20:18 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Martin Kammerhofer
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
Graz Uni
>Environment:
System: FreeBSD Martin.liebt.Susi 6.1-STABLE FreeBSD 6.1-STABLE #6: Wed Jun 7 12:03:19 CEST 2006 toor@Martin.liebt.Susi:/usr/src/sys/i386/compile/P2B-S i386
>Description:
Lightweight and more flexible replacement for misc/portell
>How-To-Repeat:
>Fix:
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	portless
#	portless/Makefile
#	portless/pkg-descr
#	portless/files
#	portless/files/portless.1
#	portless/files/portless.sh
#
echo c - portless
mkdir -p portless > /dev/null 2>&1
echo x - portless/Makefile
sed 's/^X//' >portless/Makefile << 'END-of-portless/Makefile'
X# New ports collection makefile for:   portless
X# Date created:        8 June 2006
X# Whom:                Martin Kammerhofer
X#
X# $FreeBSD$
X#
X
XPORTNAME=	portless
XPORTVERSION=	0.1
XCATEGORIES=	misc
XMASTER_SITES=	# empty
XDISTFILES=	# none
XEXTRACT_ONLY=	# empty
X
XMAINTAINER=	mkamm@gmx.net
XCOMMENT=	Quick display of files inside the FreeBSD ports tree
X
XRUN_DEPENDS=	less:${PORTSDIR}/sysutils/less
X
XNO_BUILD=	yes
XMAN1=		portless.1
XMANCOMPRESSED=	no
X
XPLIST_FILES=	bin/portless
X
Xdo-install:
X	${INSTALL_SCRIPT} ${FILESDIR}/portless.sh ${PREFIX}/bin/portless
X	${INSTALL_MAN} ${FILESDIR}/portless.1 ${PREFIX}/man/man1
X
X.include <bsd.port.mk>
END-of-portless/Makefile
echo x - portless/pkg-descr
sed 's/^X//' >portless/pkg-descr << 'END-of-portless/pkg-descr'
Xportless is a small shell script which lets FreeBSD users quickly browse
Xport descriptions given the port's name or a glob. Basically to view
Xthe descriptions of GCC (related) ports you type
X	portless gcc\*
Xand portless will display the descriptions of all gcc* ports.
XThere are options to display the postinstall messages or Makefiles instead.
X
X- Martin Kammerhofer
X   mkamm@gmx.net
END-of-portless/pkg-descr
echo c - portless/files
mkdir -p portless/files > /dev/null 2>&1
echo x - portless/files/portless.1
sed 's/^X//' >portless/files/portless.1 << 'END-of-portless/files/portless.1'
X.\" Copyright (c) 2006 Martin Kammerhofer
X.\" All rights reserved.
X.\"
X.\" Redistribution and use in source and binary forms, with or without
X.\" modification, are permitted provided that the following conditions
X.\" are met:
X.\" 1. Redistributions of source code must retain the above copyright
X.\"    notice, this list of conditions and the following disclaimer.
X.\" 2. Redistributions in binary form must reproduce the above copyright
X.\"    notice, this list of conditions and the following disclaimer in the
X.\"    documentation and/or other materials provided with the distribution.
X.\"
X.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X.\" SUCH DAMAGE.
X.\"
X.\" @(#)portless.1,v 1.1 2006/06/08 10:10:56 martin Exp
X.\"
X.\" Note: The date here should be updated whenever a non-trivial
X.\" change is made to the manual page.
X.Dd June 8, 2006
X.Dt PORTLESS 1
X.Os
X.Sh NAME
X.Nm portless
X.Nd "quickly browse port descriptions"
X.Sh SYNOPSIS
X.Nm
X.Op Fl dfiMmp
X.Op Fl P Ar pager
X.Ar portglob...
X.Sh DESCRIPTION
X.Nm
Xlets FreeBSD users quickly browse port descriptions given the port's
Xname or a (shell type) glob.
X.Pp
XThe options are as follows:
X.Bl -tag -width ".Fl P Ar pager"
X.It Fl d
XDisplay the
X.Pa pkg-descr
Xfile of the port. This is the default.
X.It Fl f
XTake the
X.Ar portglob
Xargument literal (not as a shell glob).
X.It Fl i
XDisplay the
X.Pa distinfo
Xfile of the port.
X.It Fl M
XDisplay the
X.Pa Makefile
Xfile of the port.
X.It Fl m
XDisplay the
X.Pa pkg-message
Xfile of the port.
X.It Fl p
XDisplay the
X.Pa pkg-plist
Xfile of the port.
X.It Fl P Ar pager
XUse the
X.Ar pager
Xprogram to display the files rather than the program specified by the
X.Ev PAGER
Xenvironment variable or the default of
X.Dq Pa less -e
X\&.
X.El
X.Sh ENVIRONMENT
XThe
X.Nm
Xcommand uses the
X.Ev PORTSDIR
X(default:
X.Pa /usr/ports
X) and the
X.Ev PAGER
X(default:
X.Dq Pa less -e
X) environment variables.
X.Sh FILES
X.Bl -tag -width ".Pa /usr/ports/*/*/*" -compact
X.It Pa /usr/ports/*/*/*
X.El
X.Sh EXAMPLES
XThe following is an example of a typical usage
Xof the
X.Nm
Xcommand:
X.Pp
X.Dl "portless gcc\e*"
X.Sh AUTHOR
XThe
X.Nm
Xutility and this manual page were written by
X.An Martin Kammerhofer Aq mkamm@gmx.net .
X.\" EOF
END-of-portless/files/portless.1
echo x - portless/files/portless.sh
sed 's/^X//' >portless/files/portless.sh << 'END-of-portless/files/portless.sh'
X#! /bin/sh --
X# (X)Emacs: -*- mode: Shell-Script; coding: iso8859-1; -*-
X# @(#)portless.sh,v 1.3 2006/06/08 10:10:56 martin Exp
X# Show "pkg-descr" file of matching port(s).
X#
X# Copyright (c) 2006 Martin Kammerhofer <mkamm@gmx.net>
X# All rights reserved.
X# Redistribution and use in source and binary forms, with or without
X# modification, are permitted provided that the following conditions
X# are met:
X# 1. Redistributions of source code must retain the above copyright
X#    notice, this list of conditions and the following disclaimer.
X# 2. Redistributions in binary form must reproduce the above copyright
X#    notice, this list of conditions and the following disclaimer in the
X#    documentation and/or other materials provided with the distribution.
X#
X# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
X# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X# ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
X# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X# SUCH DAMAGE.
X
XScript=`basename $0` # name of this script
X
X# set defaults
Xopt_f=""
XPORTSDIR=${PORTSDIR:-/usr/ports}
XPAGER=${PAGER=$:-less -e}
XPKGDESCR="pkg-descr"
X
X# print usage message to stderr and exit
Xusage()
X{
X    while [ $# != 0 ]; do
X	echo >&2 "$Script: $1"
X	shift
X    done
X    echo >&2 "usage: $Script [-dfiMmp] [-P pager] 'portglob'..."
X    exit 64	# EX_USAGE
X}
X
X# process options
Xwhile getopts "D:dfiMmpP:" option
X  do
X  case "$option" in
X      (D) PORTSDIR="$OPTARG";;
X      (d) PKGDESCR="pkg-descr";;
X      (f) opt_f="f";;
X      (i) PKGDESCR="distinfo";;
X      (M) PKGDESCR="Makefile";;
X      (m) PKGDESCR="pkg-message";;
X      (p) PKGDESCR="pkg-plist";;
X      (P) PAGER="$OPTARG";;
X      (*) usage;;
X  esac
Xdone
Xshift $(($OPTIND - 1))
X
X# there must be at least one argument
Xif [ $# = 0 ]; then
X    usage
Xfi
X
X# main
Xfor p in "$@"; do
X    case "$p" in
X	(*/*/*)
X	usage "portglob '$p' contains more than one slash!";;
X
X	(*/*)
X	if [ -n "$opt_f" ]; then
X	    $PAGER "$PORTSDIR/$p/$PKGDESCR"
X	else
X	    $PAGER "$PORTSDIR"/$p/"$PKGDESCR"
X	fi;;
X
X	(*)
X	if [ -n "$opt_f" ]; then
X	    $PAGER "$PORTSDIR"/[a-z]*/"$p/$PKGDESCR"
X	else
X	    $PAGER "$PORTSDIR"/[a-z]*/$p/"$PKGDESCR"
X	fi;;
X    esac
Xdone
X
X#EOF#
END-of-portless/files/portless.sh
exit


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606081058.k58AwAI5021088>