-
Notifications
You must be signed in to change notification settings - Fork 0
/
newbin
executable file
·51 lines (39 loc) · 1.67 KB
/
newbin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# Just a fast way to start editing a new script
# TODO: DRY functionality with vimwhich, there is or at least should be some overlap. Maybe vimwhich should call newbin
# if it doesn't find the right script?
. $SKIGGETY_UTILS_DIR/lib/skiggety-utils.bash || exit 1
# TODO^10?: maybe you could configure in which bin directory new scripts end up in, or at least do an EASY HACK to throw zl-* in the right place
if [ "$1" == "$(basename $1)" ];then
new_file="$SKIGGETY_UTILS_DIR/bin/$1"
else
new_file="$1"
fi
debug_eval new_file
shift
if [ x"$@"x == x""x ]; then
debug_here
shebang_args="env bash"
else
debug_here
shebang_args="$@"
fi
if ! [ -f $new_file ]; then
debug_eval_here shebang_args
shebang $shebang_args > $new_file
# TODO^131: (IN_PROGRESS) I think this script, newbin, should move scripts to zerothlife when appropriate, not some dashboard running async, this chmod is not the only thing that has gotten screwed up:
# TODO: frozen string literal thingy if ruby
if [ "$shebang_args" == 'env bash' ];then
# EASY TODO^10: copy a template file instead of writing it out here...:
debug_here
echo >> $new_file
echo '# This script (...TODO, describe your script here, and DO_NOT''_COMMIT until then.)' >> $new_file # IGNORE_TODO
echo >> $new_file
echo ". \$SKIGGETY_UTILS_DIR/lib/skiggety-utils.bash || exit 1" >> $new_file
echo >> $new_file
echo "interactive_develop_here 'Code something up probably?'" >> $new_file
echo "exit_with_error \"TODO: IMPLEMENT and TEST this script\"" >> $new_file # IGNORE_TODO
fi
chmod +x $new_file
fi
$EDITOR $new_file