aboutsummaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorclsung <clsung@FreeBSD.org>2006-08-30 23:14:00 +0800
committerclsung <clsung@FreeBSD.org>2006-08-30 23:14:00 +0800
commit7e6656fb3fc963111932f59bf9145aec3b0584f9 (patch)
treed5fa4ea7006b5f0ac802c50c13d627153c93da37 /misc
parent85f28fe6654fe676dc229fafc6ec166c17b35ac9 (diff)
downloadfreebsd-ports-gnome-7e6656fb3fc963111932f59bf9145aec3b0584f9.tar.gz
freebsd-ports-gnome-7e6656fb3fc963111932f59bf9145aec3b0584f9.tar.zst
freebsd-ports-gnome-7e6656fb3fc963111932f59bf9145aec3b0584f9.zip
- Update to 0.2.5
- Addition of -W option and minor bug fixed where whitespace at begin/end of portglob argument was not properly rejected. PR: ports/102695 Submitted by: maintainer (Martin Kammerhofer)
Diffstat (limited to 'misc')
-rw-r--r--misc/portless/Makefile2
-rw-r--r--misc/portless/files/portless.125
-rw-r--r--misc/portless/files/portless.sh37
3 files changed, 40 insertions, 24 deletions
diff --git a/misc/portless/Makefile b/misc/portless/Makefile
index 2974c7d9b03b..d1a3e2045b44 100644
--- a/misc/portless/Makefile
+++ b/misc/portless/Makefile
@@ -6,7 +6,7 @@
#
PORTNAME= portless
-PORTVERSION= 0.2.4
+PORTVERSION= 0.2.5
CATEGORIES= misc
MASTER_SITES= # empty
DISTFILES= # none
diff --git a/misc/portless/files/portless.1 b/misc/portless/files/portless.1
index 2b0e51c52cae..0c8dcb5b6c69 100644
--- a/misc/portless/files/portless.1
+++ b/misc/portless/files/portless.1
@@ -22,11 +22,11 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)portless.1,v 1.7 2006/08/13 10:23:14 martin Exp
+.\" @(#)portless.1,v 1.10 2006/08/30 09:36:44 martin Exp
.\"
.\" Note: The date here should be updated whenever a non-trivial
.\" change is made to the manual page.
-.Dd August 13, 2006
+.Dd August 30, 2006
.Dt PORTLESS 1
.Os
.Sh NAME
@@ -38,7 +38,7 @@
.Op Fl P Ar pager
.Ar portglob...
.Nm
-.Op Fl w
+.Op Fl W | w
.Ar portglob...
.Sh DESCRIPTION
.Nm
@@ -58,7 +58,7 @@ argument literal (not as a shell glob).
.It Fl I
Ignore case when matching
.Ar portglob
-against the ports tree. This option is only effective when
+against the ports tree. This option is only effective if
.Ar portglob
contains at least one unquoted globbing meta-character (
.Sq Li * ,
@@ -93,8 +93,19 @@ Rather than browsing files inside the ports tree just echo the names
of directories matching
.Ar portglob
to stdout.
-This option is incompatible with all other options.
+.It Fl W
+Like
+.Fl w
+but echoes just the last two components of the directory (i.e.\&
+.Em category/portname
+) to stdout.
.El
+.Lp
+Options
+.Fl W
+and
+.Fl w
+are incompatible with all other options.
.Sh ENVIRONMENT
The
.Nm
@@ -129,8 +140,4 @@ The
.Nm
utility and this manual page were written by
.An Martin Kammerhofer Aq mkamm@gmx.net .
-.Sh BUGS
-The
-.Fl w
-option is a retrofitted hack.
.\" EOF
diff --git a/misc/portless/files/portless.sh b/misc/portless/files/portless.sh
index 27d0aee134a2..d8f112c5844d 100644
--- a/misc/portless/files/portless.sh
+++ b/misc/portless/files/portless.sh
@@ -1,6 +1,6 @@
#! @BASH@ --
# (X)Emacs: -*- mode: Shell-Script; coding: iso8859-1; -*-
-# @(#)portless.sh,v 1.11 2006/08/13 10:23:14 martin Exp
+# @(#)portless.sh,v 1.12 2006/08/30 09:21:22 martin Exp
# Show "pkg-descr" file of matching port(s).
#
# Copyright (c) 2006 Martin Kammerhofer <mkamm@gmx.net>
@@ -29,7 +29,7 @@
Script=`basename $0` # name of this script
# set defaults
-for opt in d f I i M m p w; do
+for opt in d f I i M m P p W w; do
eval opt_$opt=""
done
PORTSDIR=${PORTSDIR:-/usr/ports}
@@ -45,7 +45,7 @@ usage()
echo >&2 "$Script: $1"
shift
done
- echo >&2 "usage: $Script [-dfIiMmpw] [-P pager] 'portglob'..."
+ echo >&2 "usage: $Script [-dfIiMmp | -Ww] [-P pager] 'portglob'..."
exit 64 # EX_USAGE
}
@@ -60,20 +60,21 @@ addopt()
}
# process options
-while getopts "D:dfIiMmpP:wx" option
+while getopts "D:dfIiMmpP:Wwx" option
do
case "$option" in
(D) PORTSDIR="$OPTARG";; # undocumented
(d) addopt d "$PKGDESCR";;
(f) opt_f="f";;
(I) shopt -s nocaseglob ||
- usage "Option -I needs bash!"
+ usage "option -I needs bash!"
opt_I="I";;
(i) addopt i "distinfo";;
(M) addopt M "Makefile";;
(m) addopt m "pkg-message";;
(p) addopt p "pkg-plist";;
- (P) PAGER="$OPTARG";;
+ (P) PAGER="$OPTARG"; opt_P="P";;
+ (W) opt_W="W";;
(w) opt_w="w";;
(x) set -x;; # undocumented
(*) usage;;
@@ -81,12 +82,13 @@ while getopts "D:dfIiMmpP:wx" option
done
shift $(($OPTIND - 1))
[ -d "$PORTSDIR" ] || fatal "No such directory '$PORTSDIR'"
-if [ -n "$opt_w" ]; then
- [ -n "$filelist" ] && usage "option -w not compatible with other options"
+if [ -n "$opt_W" -o -n "$opt_w" ]; then
+ [ -n "$filelist" -o -n "$opt_P" -o -n "$opt_W" -a -n "$opt_w" ] &&
+ usage "options -W and -w are not compatible with any other option!"
PAGER="/bin/ls -1d" # just echo directory name(s)
filelist="."
elif [ -n "$opt_f" -a -n "$opt_I" ]; then
- usage "only one of options -f and -I is useful"
+ usage "only one of options -f and -I is useful!"
else
[ -n "$filelist" ] || filelist="$PKGDESCR"
fi
@@ -105,7 +107,6 @@ page() {
dirglob=$1
portglob=$2
shift 2
- set +f
for f in $filelist; do
if [ -n "$opt_f" ]; then
set -- "$@" "$PORTSDIR"$dirglob"$portglob/$f"
@@ -113,14 +114,22 @@ page() {
set -- "$@" "$PORTSDIR"$dirglob$portglob/"$f"
fi
done
- $PAGER "$@" || { rc=$?; return $rc; } # remember last error code
+ if [ -n "$opt_W" -o -n "$opt_w" ]; then
+ lstrip=""
+ [ -n "$opt_W" ] && lstrip=-e\ 's;^.*/\([^/]*/[^/]*\)$;\1;'
+ {
+ $PAGER "$@" | grep -Ev '/distfiles/|/packages/' |
+ sed -e 's;/.$;;' $lstrip
+ } || { rc=$?; return $rc; } # remember last error code
+ else
+ $PAGER "$@" || { rc=$?; return $rc; } # remember last error code
+ fi
}
# main
for p in "$@"; do
- set -f
- set -- $p
- [ $# != 1 ] && usage "portglob '$p' contains whitespace!"
+ expr "$p" : ".*[$IFS]" >/dev/null &&
+ usage "portglob '$p' contains whitespace!"
case "$p" in
(*/*/*)
usage "portglob '$p' contains more than one slash!";;