1#!/bin/sh
2#
3# vi:set et ai sw=2 sts=2 ts=2:
4# -
5# engrampa.tap - Wrapper script to create and extract archive files in Thunar,
6#                via the thunar-archive-plugin, using the engrampa archive
7#                manager.
8#
9# Copyright (c) 2017 Andre Miranda <andreldm@xfce.org>
10#
11# This program is free software; you can redistribute it and/or
12# modify it under the terms of the GNU General Public License as
13# published by the Free Software Foundation; either version 2 of
14# the License, or (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public
22# License along with this program; if not, write to the Free
23# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24# Boston, MA 02110-1301, USA.
25
26# determine the action and the folder, $@ then contains only the files
27action=$1; shift;
28folder=$1; shift;
29
30# check the action
31case $action in
32create)
33	exec engrampa --default-dir="$folder" --add "$@"
34	;;
35
36extract-here)
37	exec engrampa --extract-to="$(pwd)" --extract-here --force "$@"
38	;;
39
40extract-to)
41	exec engrampa --extract "$@"
42	;;
43
44*)
45	echo "Unsupported action '$action'" >&2
46	exit 1
47esac
48
49