Closed chellige closed 1 year ago
Hi, and thanks!
We need a TERM value for tput
command. That's a requirement of terminfo. But there is a possibility to force the value with tput:
EDIT: Oh, you mentionned that, sorry
-Ttype indicates the type of terminal. Normally this option is unnecessary, because the default is taken from the environment variable TERM. If -T is specified, then the shell variables LINES and COLUMNS will also be ignored.
That should be very complex to fix.
For the "no loop", I didn't test but you can call what is here: https://github.com/metal3d/bashsimplecurses/blob/aa244b834a9de0e09f0363af128de7a7f98dde08/simple_curses.sh#L704 removing the "loop". Maybe I refactor to be able to run the display once. Nice idea!
Removing the loop seems to work. I got the script to run on my "github.com/bugy/script-server" web ui but unfortunately it looses the box formatting. Get a bunch of garbage characters also. Works perfectly from the CLI though. Was hoping I could use these two together but does not look like it's going to work.
Thanks for your assistance. Great product!
Could you not pass the $TERM
variable over to BSC?
You can try the feat-one-shot-loop
branch containing this commit:
https://github.com/metal3d/bashsimplecurses/commit/e3caef197c5c70f897bd67e0c8f442060669469c
Using --one-shot
argument to the main_loop
call should quit after display.
@chellige actually there is (now) an easy way to do a "one shot" display. Only create an function named update()
that exits the script:
main(){
# do your windows
}
update(){
exit 0
}
main_loop
The update function will then stop the script. So, the feat-one-shot-loop
is useless. We can add this trick in the documentation π
Thanks for working on this. Unfortunately that did not help. Still getting garbage characters instead of box lines. It looks something like this: 7ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 77 87β FORWARD LOOKUP8 β 77 8ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
Can you please provide us a code snippet and some condition to start the script? Please, use the triple backtick syntax to encapsulate your logs and code. See the markdown help:
Sure. As a reminder, it works fine from the console but it has display issues when running in script-server
# cat /opt/dnstools/conf/scripts/sc.sh
#!/bin/bash
DISPLAY=localhost:0.0
TERM=xterm
source /usr/local/lib/simple_curses.sh
zoneName=$1
Total=0
fwd_responses=( $(dig +short ${zoneName}) )
for IP in ${fwd_responses[@]} ; do dig +noall +answer -x ${IP} ; done > /tmp/rev-responses
main(){
window "FORWARD LOOKUP" "yellow" "100%"
append_command "dig +noall +answer ${zoneName}"
Total=$((Total + 1))
endwin
window "TERMINAL TYPE" "yellow" "100%"
append_command "echo $TERM"
append_command "echo $DISPLAY"
endwin
window "REVERSE LOOKUP" "yellow" "100%"
append_file /tmp/rev-responses
endwin
window "NS SERVERS" "yellow" "100%"
append_command "dig NS +noall +answer ${zoneName}"
endwin
if [[ ${Total} -gt 1 ]]; then exit 0 ; fi
}
update(){
exit 0
}
main_loop
rm -rf /tmp/rev-responses
# /opt/dnstools/conf/scripts/sc.sh google.com
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FORWARD LOOKUP β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
βgoogle.com. 222 IN A 142.251.40.46 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TERMINAL TYPE β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
βvt100 β
βlocalhost:0.0 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β REVERSE LOOKUP β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β174.72.250.142.in-addr.arpa. 82975 IN PTR lax17s50-in-f14.1e100.net. β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β NS SERVERS β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
βgoogle.com. 342744 IN NS ns4.google.com. β
βgoogle.com. 342744 IN NS ns2.google.com. β
βgoogle.com. 342744 IN NS ns3.google.com. β
βgoogle.com. 342744 IN NS ns1.google.com. β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
77 87β FORWARD LOOKUP8 β
77 8ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
77 87βgoogle.com. 197 IN A 142.250.68.788 β
7ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
77 87β TERMINAL TYPE8 β
77 8ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
77 87βvt1008 β
77 87βlocalhost:0.08 β
7ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
77 87β REVERSE LOOKUP8 β
77 8ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
77 87β174.72.250.142.in-addr.arpa. 84376 IN PTR lax17s50-in-f14.1e100.net.8 β
7ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
77 87β NS SERVERS8 β
77 8ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
77 87βgoogle.com. 342328 IN NS ns1.google.com.8 β
77 87βgoogle.com. 342328 IN NS ns2.google.com.8 β
77 87βgoogle.com. 342328 IN NS ns3.google.com.8 β
77 87βgoogle.com. 342328 IN NS ns4.google.com.8 β
7ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7
Ho! Script-serverβ¦ the problem is not our side, so. A lot of βrich outputβ script fails with it. For example: https://github.com/bugy/script-server/issues/323
I don't know how to fix this... the problem is that specific terminal requests are badly encoded via script-server.
Thanks so much for looking into this. I read that post and tried the ENV variables they suggested but no luck. I will follow up with the script-server team.
I think that I can see the problem. If I strip some escaped chars, I can see this:
But it doesn't works with side-by-side windows. The problem is tput cud1
and some others controls which are not well encoded by script-server.
That could be useable for most things. These two products together would be awesome, assuming the active refresh of content works like it does on the terminal. How did you strip escaped chars?
First, let me say, this is Awesome - Thank you!
I was wondering if it would be possible to have an option to NOT use xterm, not loop, and just simply run each script once and display the output (while still keeping your incredible output format).
I'm having issues running remotely: tput: No value for $TERM and no -T specified and simplifying the environment should solve that, if it's feasible.
Thanks again.