Added shtpl installer, path variables
This commit is contained in:
parent
9ce116ef89
commit
0dfc76bd1a
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env shtpl
|
||||
SHTPL path:
|
||||
$__shtpl_path__
|
||||
SHTPL dir:
|
||||
$__shtpl_dir__
|
||||
|
||||
Current template path:
|
||||
$__tpl_path__
|
||||
Current template dir:
|
||||
$__tpl_dir__
|
||||
Current template filename:
|
||||
$__tpl_name__
|
||||
|
||||
Current working dir:
|
||||
$(pwd)
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env shtpl
|
||||
SHTPL path:
|
||||
$__shtpl_path__
|
||||
SHTPL dir:
|
||||
$__shtpl_dir__
|
||||
|
||||
Current template path:
|
||||
$__tpl_path__
|
||||
Current template dir:
|
||||
$__tpl_dir__
|
||||
Current template filename:
|
||||
$__tpl_name__
|
||||
|
||||
Current working dir:
|
||||
$(pwd)
|
||||
|
||||
Sub template
|
||||
------------
|
||||
|
||||
$($__tpl_dir__/shtpl/B.shtpl)
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
from=$(pwd)/$(dirname "$0")
|
||||
to=/usr/local/bin
|
||||
|
||||
cp $from/shtpl $to/shtpl
|
17
shtpl/shtpl
17
shtpl/shtpl
|
@ -1,11 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
# Utils
|
||||
|
||||
__shtpl_path__=$(realpath $0)
|
||||
__shtpl_dir__=$(dirname $0)
|
||||
__tpl_path__=$(realpath $1)
|
||||
__tpl_name__=$(basename $__tpl_path__)
|
||||
__tpl_dir__=$(dirname $__tpl_path__)
|
||||
|
||||
|
||||
# Execution
|
||||
|
||||
eval "echo \"$(cat $1 | sed '
|
||||
# Suppress hashbang
|
||||
1{ /#\!.*shtpl/ d }
|
||||
# Excape quotes
|
||||
s/"/\\"/g
|
||||
')\""
|
||||
|
||||
|
||||
#eval "echo \"$(perl -p -e 's/"/\\"/g' $1)\""
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue