]> arthur.barton.de Git - ax-zsh.git/blob - bin/axttyinfo
axzshctl: Look harder for themes in remote modules
[ax-zsh.git] / bin / axttyinfo
1 #!/usr/bin/env zsh
2 #
3 # AX-ZSH: Alex' Modular ZSH Configuration
4 # Copyright (c) 2015-2017 Alexander Barton <alex@barton.de>
5 #
6
7 source "$AXZSH/core/11_terminal/11_terminal.zshrc" || exit 1
8
9 unset VERBOSE
10
11 while [[ $# -gt 0 ]]; do
12         case "$1" in
13                 "-v")
14                         VERBOSE=1
15                         ;;
16                 *)
17                         echo "Usage: ttyinfo [-v]" >&2
18                         exit 1
19         esac
20         shift
21 done
22
23 print -Pn -- "$fg[white]$FX[bold]$(hostname)$FX[no-bold] "
24 print -Pn -- "$fg[yellow]$(tty)$FX[reset], "
25 print -Pn -- "$fg[green]$FX[underline]${TERM:-?}$FX[reset] "
26 print -Pn -- "(${COLUMNS:-?}x${LINES:-?}); "
27 print -Pn -- "$fg[white]LANG=${LANG:-?}$FX[reset]"
28 echo
29
30 [[ -z "$VERBOSE" ]] && return 0
31
32 check_function_result() {
33         "$1"; r=$?
34         print -Pn -- " - $fg[white]$1$FX[reset]() = "
35         if [[ $r -eq 0 ]]; then
36                 print -P -- "$fg[green]yes$FX[reset]"
37         else
38                 print -P -- "$fg[red]NO$FX[reset]"
39         fi
40         return $r
41 }
42
43 echo
44 for f (
45         axzsh_is_dumb_terminal
46         axzsh_is_modern_terminal
47         axzsh_is_utf_terminal
48         axzsh_is_widechar_terminal
49 ); do
50         check_function_result "$f"
51 done
52 echo