textastic.plugin.zsh 386 Bytes
Newer Older
Chris Smith's avatar
Chris Smith committed
1
2
3
4
5
6
#
# If the tt command is called without an argument, launch Textastic
# If tt is passed a directory, cd to it and open it in Textastic
# If tt is passed a file, open it in Textastic
#
function tt() {
Chris Smith's avatar
Chris Smith committed
7
    if [[ -z "$1" ]]
Chris Smith's avatar
Chris Smith committed
8
9
10
    then
        open -a "textastic.app"
    else
Chris Smith's avatar
Chris Smith committed
11
12
        open -a "textastic.app" "$1"
        if [[ -d "$1" ]]
Chris Smith's avatar
Chris Smith committed
13
        then
Chris Smith's avatar
Chris Smith committed
14
            cd "$1"
Chris Smith's avatar
Chris Smith committed
15
16
17
        fi
    fi
}