case insensitive and - for qcd
This commit is contained in:
6
droopy
6
droopy
@@ -713,12 +713,14 @@ class HTTPUploadHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
|||||||
# -- Save file (numbered to avoid overwriting, ex: foo-3.png)
|
# -- Save file (numbered to avoid overwriting, ex: foo-3.png)
|
||||||
form = DroopyFieldStorage(fp = self.rfile, environ = env);
|
form = DroopyFieldStorage(fp = self.rfile, environ = env);
|
||||||
fileitem = form[self.form_field]
|
fileitem = form[self.form_field]
|
||||||
|
realname=""
|
||||||
if self.form_realname in form.keys():
|
if self.form_realname in form.keys():
|
||||||
realname = form[self.form_realname].value.decode('utf-8')
|
realname = form[self.form_realname].value.decode('utf-8')
|
||||||
|
if realname=="":
|
||||||
|
filename = self.basename(fileitem.filename).decode('utf-8')
|
||||||
|
else:
|
||||||
self.log_message("Got realname: %s", realname)
|
self.log_message("Got realname: %s", realname)
|
||||||
filename=self.basename(realname)
|
filename=self.basename(realname)
|
||||||
else:
|
|
||||||
filename = self.basename(fileitem.filename).decode('utf-8')
|
|
||||||
|
|
||||||
if filename == "":
|
if filename == "":
|
||||||
self.send_response(303)
|
self.send_response(303)
|
||||||
|
|||||||
30
qcd_function
30
qcd_function
@@ -19,8 +19,9 @@ function qcd() {
|
|||||||
local OPTIND
|
local OPTIND
|
||||||
local OPTARG
|
local OPTARG
|
||||||
local opt
|
local opt
|
||||||
|
local case
|
||||||
|
|
||||||
while getopts aLl:hm opt
|
while getopts aiLl:hm opt
|
||||||
do case "$opt" in
|
do case "$opt" in
|
||||||
a)
|
a)
|
||||||
# Adding
|
# Adding
|
||||||
@@ -33,6 +34,9 @@ function qcd() {
|
|||||||
echo "$name":$( pwd ) >> ~/.qcd
|
echo "$name":$( pwd ) >> ~/.qcd
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
i)
|
||||||
|
case="-i"
|
||||||
|
;;
|
||||||
L)
|
L)
|
||||||
echo ==History ~/.bash_cdhistory:
|
echo ==History ~/.bash_cdhistory:
|
||||||
cat ~/.bash_cdhistory
|
cat ~/.bash_cdhistory
|
||||||
@@ -42,7 +46,7 @@ function qcd() {
|
|||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
l)
|
l)
|
||||||
local d=$( grep -h ^"$OPTARG" ~/.qcd <( tac ~/.bash_cdhistory ) | head -n 1 )
|
local d=$( grep $case -h ^"$OPTARG" ~/.qcd <( tac ~/.bash_cdhistory ) | head -n 1 )
|
||||||
d=${d/*:/}
|
d=${d/*:/}
|
||||||
echo $d
|
echo $d
|
||||||
return
|
return
|
||||||
@@ -64,14 +68,14 @@ function qcd() {
|
|||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
h)
|
h)
|
||||||
echo 'qcd [-mLh]|[-al] [name]
|
echo 'qcd [-hiLm]|[-al] [name]
|
||||||
Change current working path based on the list ~/.qcd
|
Change current working path based on the list ~/.qcd
|
||||||
Keeps a history of folders visited in ~/.bash_cdhistory
|
Keeps a history of folders visited in ~/.bash_cdhistory
|
||||||
|
|
||||||
-a [name] Adds the path to the list
|
-a [name] Adds the path to the list
|
||||||
You may add the name of the path, but when omitted
|
You may add the name of the path, but when omitted
|
||||||
the basename will be used
|
the basename will be used
|
||||||
|
-i Case insensitive search, must come first.
|
||||||
-l [name] Show the match, but do not change
|
-l [name] Show the match, but do not change
|
||||||
-L Lists the paths
|
-L Lists the paths
|
||||||
-m Maintain the list, deleting non-existing entries'
|
-m Maintain the list, deleting non-existing entries'
|
||||||
@@ -79,17 +83,21 @@ Keeps a history of folders visited in ~/.bash_cdhistory
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
shift $(($OPTIND - 1))
|
||||||
unset OPTSTRING
|
unset OPTSTRING
|
||||||
unset OPTIND
|
unset OPTIND
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]
|
||||||
then \cd
|
then \cd; return
|
||||||
else
|
|
||||||
d=$( grep -h ^"$1" ~/.qcd <( tac ~/.bash_cdhistory ) | head -n 1 )
|
|
||||||
d=${d/*:/}
|
|
||||||
if [ ! -z "$d" ]
|
|
||||||
then \cd "$d"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
if [ "$1" = "-" ]
|
||||||
|
then \cd -; return
|
||||||
|
fi
|
||||||
|
d=$( grep $case -h ^"$1" ~/.qcd <( tac ~/.bash_cdhistory ) | head -n 1 )
|
||||||
|
d=${d/*:/}
|
||||||
|
if [ ! -z "$d" ]
|
||||||
|
then \cd "$d"
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user