Add sh editing mode based on the python mode

This commit is contained in:
richo 2012-03-10 18:06:04 +11:00 • committed by Fabian Jakobs
commit d6a21166fc
5 changed files with 313 additions and 2 deletions

View file

@ -125,7 +125,8 @@ var modes = [
new Mode("svg", "SVG", require("ace/mode/svg").Mode, ["svg"]),
new Mode("text", "Text", require("ace/mode/text").Mode, ["txt"]),
new Mode("textile", "Textile", require("ace/mode/textile").Mode, ["textile"]),
new Mode("xml", "XML", require("ace/mode/xml").Mode, ["xml"])
new Mode("xml", "XML", require("ace/mode/xml").Mode, ["xml"]),
new Mode("sh", "SH", require("ace/mode/sh").Mode, ["sh"])
];
modesByName = {};
@ -232,6 +233,10 @@ var docs = [
"haxe", "haXe",
require("ace/requirejs/text!./docs/Haxe.hx")
),
new Doc(
"sh", "SH",
require("ace/requirejs/text!./docs/sh.sh")
),
new WrappedDoc(
"markdown", "Markdown",
require("ace/requirejs/text!./docs/markdown.md")

38
demo/kitchen-sink/docs/sh.sh Executable file
View file

@ -0,0 +1,38 @@
#!/bin/sh
# Script to open a browser to current branch
# Repo formats:
# ssh git@github.com:richoH/gh_pr.git
# http https://richoH@github.com/richoH/gh_pr.git
# git git://github.com/richoH/gh_pr.git
username=`git config --get github.user`
get_repo() {
git remote -v | grep ${@:-$username} | while read remote; do
if repo=`echo $remote | grep -E -o "git@github.com:[^ ]*"`; then
echo $repo | sed -e "s/^git@github\.com://" -e "s/\.git$//"
exit 1
fi
if repo=`echo $remote | grep -E -o "https?://([^@]*@)?github.com/[^ ]*\.git"`; then
echo $repo | sed -e "s|^https?://||" -e "s/^.*github\.com\///" -e "s/\.git$//"
exit 1
fi
if repo=`echo $remote | grep -E -o "git://github.com/[^ ]*\.git"`; then
echo $repo | sed -e "s|^git://github.com/||" -e "s/\.git$//"
exit 1
fi
done
if [ $? -eq 0 ]; then
echo "Couldn't find a valid remote" >&2
exit 1
fi
}
if repo=`get_repo $@`; then
branch=`git symbolic-ref HEAD 2>/dev/null`
echo "http://github.com/$repo/pull/new/${branch##refs/heads/}"
else
exit 1
fi