forked from Worldie-com/pen.el
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcterm-docker
More file actions
executable file
·50 lines (38 loc) · 1.12 KB
/
cterm-docker
File metadata and controls
executable file
·50 lines (38 loc) · 1.12 KB
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
#!/bin/bash
export TTY
# nsfa needs to be created from within elisp
export USE_NVC
export USE_TERM
while [ $# -gt 0 ]; do opt="$1"; case "$opt" in
"") { shift; }; ;;
-bufname) {
bufname="$2"
shift
shift
}
;;
-e) {
extra_elisp="$2"
shift
shift
}
;;
*) break;
esac; done
# If already in emacs term, then start without it
if test -n "$INSIDE_EMACS" || test "$TERM" = dumb; then
"$@"
exit "$?"
fi
: ${modename:="$1"}
script="$(pen-nsfa "$@")"
: "${bufname:="$(p term "$@" | slugify | cut -c 1-30)"}"
# neovim cant be run inside emacs without compromising cursor position
if test -n "$extra_elisp"; then
extra_elisp="$(cmd-nice-posix "$extra_elisp")"
fi
# I need jqs here to force quotes if empty
elisp="(progn (pen-term (pen-nsfa $(cmd-nice-posix "$(cmd-nice-posix "$@")")) t $(cmd-nice-jq "$modename") $(cmd-nice-jq "$bufname") nil $extra_elisp))"
# the nsfa must be created on the docker side, so I can't use this
# elisp="(progn (pen-term $(cmd-nice-posix "$script") t $(cmd-nice-posix "$modename") $(cmd-nice-posix "$bufname")))"
pente "$elisp"