Commit 93a3cdd4 authored by Damyan Ivanov's avatar Damyan Ivanov

add shell integration library

parent ee69bea4
......@@ -16,7 +16,7 @@ VERSION := $(shell dpkg-parsechangelog | awk '/^Version: / { print $$2 }')
MAN_DIR := $(PREFIX)/share/man/man1
INSTALLED_SCRIPTS := $(addprefix $(DESTDIR)/$(PREFIX)/share/pkg-perl-tools/,$(SCRIPTS))
INSTALLED_SCRIPT_MANUALS := $(addprefix $(DESTDIR)/$(MAN_DIR)/dpt-,$(addsuffix .1,$(SCRIPTS)))
INSTALLED_SCRIPT_MANUALS := $(addprefix $(DESTDIR)/$(MAN_DIR)/dpt-,$(addsuffix .1,$(filter-out posix-lib.sh,$(SCRIPTS))))
INSTALLED_BINS := $(addprefix $(DESTDIR)/$(PREFIX)/bin/,$(BINS))
INSTALLED_BIN_MANUALS := $(addprefix $(DESTDIR)/$(MAN_DIR)/,$(BIN_MANUALS))
INSTALLED_LINTIAN_CHECKS := $(addprefix $(DESTDIR)/$(PREFIX)/share/lintian/checks/pkg-perl/, $(LINTIAN_CHECKS))
......
......@@ -133,6 +133,10 @@ See L<dpt-takeover(1)>.
See L<dpt-checkout(1)>.
=item B<shell-lib> - shell integration
See L<dpt-shell-lib(1)>
=back
For each command, see its manual page for more details.
......
# shell functions library
# to be sourced, not executed
# Copyright (c) 2013 Damyan Ivanov <dmn@debian.org>
# This program is free software; you can redistribute it and/or modify
# it under the terms of either:
# .
# a) the GNU General Public License as published by the Free Software
# Foundation; either version 1, or (at your option) any later
# version, or
# .
# b) the "Artistic License" which comes with Perl.
#
# the purpose of this is to hijack the 'dpt commit' invocation, parse its
# output, and thange the CWD accordingly
dpt() {
REAL=`/usr/bin/which dpt`
TMP=`mktemp -d`
trap "command rm -rf '$TMP'" 0 INT TERM PIPE
mkfifo "$TMP/pipe"
(
set +m
tee "$TMP/out" < "$TMP/pipe" &
)
ES=0
$REAL "$@" > "$TMP/pipe" || ES=$?
[ "$ES" = "0" ] || return $ES
if egrep -q "^Updating existing checkout in .+" "$TMP/out"; then
DIR=`egrep '^Updating existing' "$TMP/out" | sed -e 's/Updating existing checkout in //'`
cd "$DIR"
return 0
fi
if egrep -q "^.+ ready in .+" "$TMP/out"; then
DIR=`egrep ' ready in ' "$TMP/out" | sed -e 's/.\+ ready in //'`
cd "$DIR"
return 0
fi
return 0
}
#!/bin/sh
# copyright, license and documentation below
set -e -u
MYDIR="$(readlink -f `dirname $0`)"
usage() {
BN=`basename $0`
cat <<EOF
Usage: $BN
EOF
exit 0
}
[ -z "${1:-}" ] || usage
echo . "$DPT__SCRIPTS/posix-lib.sh"
exit 0
POD=<<'EOF'
=head1 NAME
dpt-shell-lib -- shell integration of L<dpt(1)>
=head1 SYNOPSIS
In the interactive configuration script of your shell:
`B<dpt shell-lib>`
=head1 DESCRIPTION
B<dpt shell-lib> prints out a shell command that loads some goodies when
working with packages from the Debian Perl Group.
Currently this is only a wrapper function for the L<dpt(1)> command, which
captures the output of L<dpt-checkout(1)> and changes the current directory to
the checkout.
=head1 OPTIONS
None.
=head1 COPYRIGHT & LICENSE
Copyright 2013 Damyan Ivanov <dmn@debian.org>
This program is free software and can be distributed under the same terms as
Perl.
=cut
EOF
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment