我有一个使用Oclif和NodeJS的命令行界面应用程序。我有一个自动补全脚本,如下所示:
# func gets called for the exec binart when Tab is pressed
# eg exec [Tab] [Tab] calls __func()
__func()
{
Perform an http request that takes 2-3 seconds
Populate COMPREPLY with autocomplete values
}
complete -o nospace -F __func exec因为按Tab需要几秒钟,所以在shell中有一个类似于微调的功能会很好,这样用户就可以看到自动完成正在运行。
我如何才能做到这一点?用进度条代替微调器,或者用一些圆点来表示正在加载(...)。
发布于 2020-03-12 23:13:36
你有没有试过在你的命令前后调用一个旋转器?
示例微调器:
用你的代码举例:
__func()
{
spinner.start()
Perform an http request that takes 2-3 seconds
Populate COMPREPLY with autocomplete values
spinner.end()
}
complete -o nospace -F __func exechttps://stackoverflow.com/questions/60543491
复制相似问题