replay.fish

Run Bash commands replaying changes in Fish. 🍤
授权协议 MIT License
开发语言 SHELL
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 慕宏儒
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

replay.fish

Run Bash commands replaying changes in Fish. ��

Let's say you need to run a Bash command, and want Fish to inherit changes in the environment, e.g., exported and unset variables, changes to the $PATH, and so on. How do you do that?

$ exec bash -c "$commands; exec fish"

Caveats? Unfortunately, yes.

There's no way to preserve the last command exit status. You'll lose the entire state of your session; history may not sync up correctly if you have Fish running in other terminal tabs, local variables are gone. Fish takes a little while to start up. Moreover, things Fish is configured to do on startup like running configuration snippets or displaying a custom greeting may not be appreciated. If jobs are running in the background, they'll be terminated too.

Replay runs your commands in Bash, captures exported variables, aliases, $PWD changes, and reproduces them in Fish so you don't have to exec-away your session.

Installation

Install with Fisher:

fisher install jorgebucaran/replay.fish

Quickstart

This sets the environment variable PYTHON in your session.

$ replay export PYTHON=python2
$ echo $PYTHON
python2

This will download and install the latest Node release (requires nvm).

$ replay "source ~/.nvm/nvm.sh --no-use && nvm use latest"

Bash aliases? You got it.

$ replay alias g=git
$ g init
Initialized empty Git repository in /home/users/jb/code/replay.fish/.git/

Replay will even take care of special variables like $PWD, switching directories if needed.

$ pwd
/home/users/jb/replay.fish
$ replay cd ~
$ pwd
/home/users/jb

Replay is not bulletproof! Interactive utilities, such as ssh-add are not currently supported.

License

MIT

相关阅读

相关文章

相关问答

相关文档