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,$(SCRIPTS))))
INSTALLED_BINS := $(addprefix $(DESTDIR)/$(PREFIX)/bin/,$(BINS))
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)>
For each command, see its manual page for more details.
# shell functions library
# to be sourced, not executed
# Copyright (c) 2013 Damyan Ivanov <>
# 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" &
$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
if egrep -q "^.+ ready in .+" "$TMP/out"; then
DIR=`egrep ' ready in ' "$TMP/out" | sed -e 's/.\+ ready in //'`
cd "$DIR"
return 0
return 0
# copyright, license and documentation below
set -e -u
MYDIR="$(readlink -f `dirname $0`)"
usage() {
BN=`basename $0`
cat <<EOF
Usage: $BN
exit 0
[ -z "${1:-}" ] || usage
echo . "$DPT__SCRIPTS/"
exit 0
=head1 NAME
dpt-shell-lib -- shell integration of L<dpt(1)>
In the interactive configuration script of your shell:
`B<dpt shell-lib>`
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
Copyright 2013 Damyan Ivanov <>
This program is free software and can be distributed under the same terms as
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