Ranger: fixed trash-put command to handle file beginning with an hyphen.

Shell: improved archive-project function (exclude-vcs toggle + compression method).
master
Ambrevar 2012-07-27 18:25:27 +01:00
parent 796eef901e
commit e6b4e77ec1
6 changed files with 81 additions and 12 deletions

View File

@ -1,10 +1,12 @@
auto-complete
bashmount
bustle
cgdb
dropbox
dropbox-cli
emacs-mediawiki-bzr
emacs-yasnippet
fortune-mod-tbbt
grub
gsharkdown
handbrake-cli-svn

View File

@ -21,6 +21,7 @@ bzip2
bzr
calc
catdvi
cgdb
cmus
coreutils
cpufrequtils
@ -53,6 +54,7 @@ firefox
flashplugin
flex
fortune-mod
fortune-mod-tbbt
gawk
gcc
gcc-libs
@ -85,11 +87,13 @@ iptables
iputils
irssi
ispell
jansson
jfsutils
laptop-mode-tools
less
libtool
licenses
lighttpd
links
linux
linux-lts

View File

@ -179,6 +179,7 @@ irssi
isl
ispell
jack
jansson
jasper
jfsutils
json-c
@ -322,6 +323,7 @@ libxxf86dga
libxxf86vm
libzen
licenses
lighttpd
links
linux
linux-api-headers

View File

@ -40,7 +40,7 @@ map <F10> exit
# map DD shell mv -t ~/.local/share/Trash/files %s
## Move to trash (with Trash-CLI)
map DD shell trash-put %s
map DD shell trash-put -- %s
## Extraction. Ranger uses '1l', but does not work when extension is not right.
map ex shell aunpack -e %s
@ -55,6 +55,7 @@ map esr shell -w svn revert %s
map ess shell -w svn status
## MPlayer
## Note that latin1 for MPlayer is cp1252 in reality.
map ev console shell mplayer "%f" -sub "%s" -subcp latin1
## Cmus

View File

@ -359,36 +359,95 @@ function texclean ()
## Create an archive from a single or multiples files/folders.
## This archive
archive-project ()
{
printhelp()
{
echo "Synopsis:"
echo -e " $1 [-m METHOD] [-v] FILE"
echo
echo "Usage:"
echo -e " default:\tDisplay packages included in FILE but not installed."
echo -e " -h:\t\tDisplay this help."
echo -e " -m:\t\tChoose compression method."
echo -e " gz\t\tgzip (default)."
echo -e " xz\t\tLZMA."
echo -e " -v:\t\tInclude VCS data."
}
OPTION_VCS="--exclude-vcs"
while getopts ":hm:v" opt; do
case $opt in
h)
printhelp "$0"
return 1
;;
m)
OPTION_METHOD="${OPTARG}"
;;
v)
OPTION_VCS=""
;;
?)
printhelp "$0"
return 1
;;
:)
echo "Missing argument."
echo "Use $0 -h for help."
return 1
;;
esac
done
case $OPTION_METHOD in
"gz")
ARCEXT="tar.gz"
ARCOPT="z"
;;
"xz")
ARCEXT="tar.xz"
ARCOPT="J"
;;
*)
ARCEXT="tar.gz"
ARCOPT="z"
;;
esac
shift $(($OPTIND - 1))
if [ $# -eq 0 ]; then
echo "Missing argument."
echo "Use $0 -h for help."
return 1
fi
if [ $# -eq 1 ]; then
ARCPATH="$(dirname $(readlink -f "$1"))"
ARCSOURCE="$(basename $(readlink -f "$1"))"
ARCNAME="${ARCSOURCE}-$(date +%y-%m-%d-%H%M%S).tgz"
ARCNAME="${ARCSOURCE}-$(date +%y-%m-%d-%H%M%S).${ARCEXT}"
(cd "$ARCPATH" && \
tar cvzf "$ARCNAME" "$ARCSOURCE" --exclude-vcs)
tar -${ARCOPT} -cvf "$ARCNAME" "$ARCSOURCE" ${OPTION_VCS})
else
ARCSOURCE="$(basename $PWD)"
ARCNAME="$(basename "$ARCSOURCE")-$(date +%y-%m-%d-%H%M%S).tgz"
ARCNAME="$(basename "$ARCSOURCE")-$(date +%y-%m-%d-%H%M%S).${ARCEXT}"
if [ $# = 0 ];then
(cd "$PWD/.." && \
tar cvzf "$ARCNAME" "$ARCSOURCE" --exclude-vcs)
tar -${ARCOPT} -cvf "$ARCNAME" "$ARCSOURCE" ${OPTION_VCS})
else
FILELIST=()
for i; do
FILELIST=(${FILELIST[*]} "$i")
done
tar cvzf "$ARCNAME" ${FILELIST[*]} --exclude-vcs
tar -${ARCOPT} -cvf "$ARCNAME" ${FILELIST[*]} ${OPTION_VCS}
fi
fi
}

View File

@ -1,7 +1,7 @@
## -*- mode:sh -*- #
################################################################################
## Shell Config -- Main
## Date 2012-07-09
## Date 2012-07-27
################################################################################
## Mask
@ -34,8 +34,9 @@ fi
## Make 'less' more friendly for non-text input files, see lesspipe(1).
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
## Choose pager.
## Manpage.
export MANPAGER="less -s"
export MANWIDTH=80
## Time display (with ls command for example)
export TIME_STYLE=+"| %d/%m/%Y %H:%M | "