给zsh 启动加个动画

item2 加载了很多东西后,启动变得无比的慢,每次启动都要等一分钟左右,于是给zsh 启动加个动画。以解除等待时候的烦躁心情。

效果如下:

操作步骤 loading.js

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
cat ~/.loading.js
var loading = require('loading-cli');



var load = loading(" 正在准备终端...");

load.frames = ["◐", "◓", "◑", "◒"];

load.start()
setTimeout(function(){
load.text = " 外部电源接触...没有异常";
},400);
setTimeout(function(){
load.text = " 思考形态以中文为基准,进行思维连接...";
},800);
setTimeout(function(){
load.text = " 同步率为 110.00%";
},1500);

setTimeout(function(){
load.text = " 交互界面连接...";
},1800);
setTimeout(function(){
load.text = " 安全装置解除...";
},2100);


// stop
setTimeout(function(){
load.stop();
console.log(" 启动成功!\n");
},3000)

2.ans.txt

    ^[[30C ^[[41mFBI WARNING^[(B^[[0m

^[[8C Federal Law provides severe civil and criminal penalties for
^[[8C the unauthorized reproduction, distribution, or exhibition of
^[[8C copyrighted motion pictures (Title 17, United States Code,
^[[8C Sections 501 and 508). The Federal Bureau of Investigation
^[[8C investigates allegations of criminal copyright infringement
^[[13C (Title 17, United States Code, Section 506).

在启动命令中加入

1
cat ~/.2.ans.txt && ~/.nvm/versions/node/v11.10.1/bin/node ~/.loading.js