aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-07-28 12:37:00 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-07-28 12:37:00 +0300
commit8edb59049a612cec78250f4d50920fa27e4cd16a (patch)
tree28de3aa2a08eaf895f101e444e49f70d1e63b303
parent0955a5637df25ca60b0605c19a5d5a61564e1701 (diff)
check that wizard can run
-rwxr-xr-xinternal/wizard.zsh37
1 files changed, 37 insertions, 0 deletions
diff --git a/internal/wizard.zsh b/internal/wizard.zsh
index 7fb55f8d..a7f82089 100755
--- a/internal/wizard.zsh
+++ b/internal/wizard.zsh
@@ -326,6 +326,43 @@ function generate_config() {
print -lr -- "$header" "$lines[@]" >$zd/$config_basename
}
+if [[ ! -o multibyte ]]; then
+ print -P "%1F[ERROR]%f %Bp9k_configure%b: multibyte option is not set" >&2
+ return 1
+fi
+if [[ "${#$(print -P '\u276F' 2>/dev/null)}" != 1 ]]; then
+ print -P "%1F[ERROR]%f %Bp9k_configure%b: shell doesn't support unicode" >&2
+ return 1
+fi
+if [[ ! -w $zd ]]; then
+ print -P "%1F[ERROR]%f %Bp9k_configure%b: $zdu is not writable" >&2
+ return 1
+fi
+if [[ -d $zd/$config_basename ]]; then
+ print -P "%1F[ERROR]%f %Bp9k_configure%b: $zdu/$config_basename is a directory" >&2
+ return 1
+fi
+if [[ -e $zd/$config_basename && ! ( -f $zd/$config_basename || -h $zd/$config_basename ) ]]; then
+ print -P "%1F[ERROR]%f %Bp9k_configure%b: $zdu/$config_basename is a special file" >&2
+ return 1
+fi
+if [[ ! -t 0 || ! -t 1 ]]; then
+ print -P "%1F[ERROR]%f %Bp9k_configure%b: no TTY" >&2
+ return 1
+fi
+if (( LINES < 20 || COLUMNS < 70 )); then
+ print -P "%1F[ERROR]%f %Bp9k_configure%b: terminal size too small" >&2
+ return 1
+fi
+if [[ ! -r $p10k_root_dir/config/p10k-lean.zsh ]]; then
+ print -P "%1F[ERROR]%f %Bp9k_configure%b: cannot read $p10k_root_dir/config/p10k-lean.zsh" >&2
+ return 1
+fi
+if [[ ! -r $p10k_root_dir/config/p10k-classic.zsh ]]; then
+ print -P "%1F[ERROR]%f %Bp9k_configure%b: cannot read $p10k_root_dir/config/p10k-classic.zsh" >&2
+ return 1
+fi
+
source $p10k_root_dir/internal/icons.zsh || return
while true; do