• Stars
    star
    392
  • Rank 109,282 (Top 3 %)
  • Language
    Shell
  • License
    MIT License
  • Created almost 10 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Run Bash commands, replay changes in Fish 🍀

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

More Repositories

1

hyperapp

1kB-ish JavaScript framework for building hypertext applications
JavaScript
19,043
star
2

fisher

A plugin manager for Fish
Shell
7,560
star
3

awsm.fish

A curation of prompts, plugins & other Fish treasures πŸšπŸ’Ž
4,066
star
4

nvm.fish

The Node.js version manager you'll adore, crafted just for Fish
Shell
2,033
star
5

cookbook.fish

From Shell to Plate: Savor the Zest of Fish 🦞
2,002
star
6

colorette

🌈Easily set your terminal text color & styles
JavaScript
1,595
star
7

superfine

Absolutely minimal view layer for building web interfaces
JavaScript
1,564
star
8

classcat

Build a class attribute string quickly
JavaScript
905
star
9

getopts

Node.js CLI options parser
JavaScript
633
star
10

hydro

Ultra-pure, lag-free prompt with async Git statusβ€”just for Fish
Shell
609
star
11

hyperawesome

A curated list of awesome projects built with Hyperapp + more
492
star
12

twist

Declarative JavaScript Testing
JavaScript
378
star
13

autopair.fish

Auto-complete matching pairs in the Fish command line
Shell
369
star
14

fishtape

100% pure-Fish test runner
Shell
345
star
15

spark.fish

β–β–‚β–„β–†β–‡β–ˆβ–‡β–†β–„β–‚β–
Shell
335
star
16

hyperapp-router

Declarative routing for Hyperapp V1 using the History API.
JavaScript
257
star
17

getopts.fish

Parse CLI options in Fish
Shell
220
star
18

gitio.fish

Create a custom git.io URL
Shell
88
star
19

hyperapp-html

Html helper functions for Hyperapp V1
JavaScript
81
star
20

pyenv

Pyenv support plugin for fish-shell
Shell
62
star
21

humantime.fish

Turn milliseconds into a human-readable string in Fish
Shell
21
star
22

.github

My health files
1
star
23

jorgebucaran.github.io

HTML
1
star