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 auto-complete
bashmount bashmount
bustle bustle
cgdb
dropbox dropbox
dropbox-cli dropbox-cli
emacs-mediawiki-bzr emacs-mediawiki-bzr
emacs-yasnippet emacs-yasnippet
fortune-mod-tbbt
grub grub
gsharkdown gsharkdown
handbrake-cli-svn handbrake-cli-svn

View File

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

View File

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

View File

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

View File

@ -359,36 +359,95 @@ function texclean ()
## Create an archive from a single or multiples files/folders. ## Create an archive from a single or multiples files/folders.
## This archive
archive-project () 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 if [ $# -eq 1 ]; then
ARCPATH="$(dirname $(readlink -f "$1"))" ARCPATH="$(dirname $(readlink -f "$1"))"
ARCSOURCE="$(basename $(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" && \ (cd "$ARCPATH" && \
tar cvzf "$ARCNAME" "$ARCSOURCE" --exclude-vcs) tar -${ARCOPT} -cvf "$ARCNAME" "$ARCSOURCE" ${OPTION_VCS})
else else
ARCSOURCE="$(basename $PWD)" 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 if [ $# = 0 ];then
(cd "$PWD/.." && \ (cd "$PWD/.." && \
tar cvzf "$ARCNAME" "$ARCSOURCE" --exclude-vcs) tar -${ARCOPT} -cvf "$ARCNAME" "$ARCSOURCE" ${OPTION_VCS})
else else
FILELIST=() FILELIST=()
for i; do for i; do
FILELIST=(${FILELIST[*]} "$i") FILELIST=(${FILELIST[*]} "$i")
done done
tar -${ARCOPT} -cvf "$ARCNAME" ${FILELIST[*]} ${OPTION_VCS}
tar cvzf "$ARCNAME" ${FILELIST[*]} --exclude-vcs
fi fi
fi fi
} }

View File

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