Giter Site home page Giter Site logo

replay.fish's People

Contributors

gabriel-del avatar jorgebucaran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

replay.fish's Issues

What's the difference between Replay and edc/bass?

  • Replay is (a bit) faster than Bass.
  • Bass requires Python.
    • Replay is mostly Fish and some Awk, but I'm planning a rewrite to remove Awk soon (#12).
$ time fish -c "replay export foo=1"
        0.01 real         0.01 user         0.00 sys
$ time fish -c "bass export foo=1"
        0.14 real         0.05 user         0.07 sys
$ time fish -c 'replay "source ~/.nvm/nvm.sh --no-use; nvm use v11.10.0"'
Now using node v11.10.0 (npm v6.7.0)
        0.70 real         0.52 user         0.18 sys
$ time fish -c 'bass "source ~/.nvm/nvm.sh --no-use; nvm use v11.10.0"'
Now using node v11.10.0 (npm v6.7.0)
        0.83 real         0.58 user         0.26 sys

cd on folder with space don't work

cd 'System Volume Information'
works, but
replay cd 'System Volume Information'
don't work, neither
replay cd System\ Volume\ Information/

erro: bash: line 2: cd: too many arguments

Running commands with $

I'm unable to run this command. I'd like to use replay to run bash commands that use $ and it's unsupported by fish.

❯ replay "export TEST=$(pwd)"
fish: $(...) is not supported. In fish, please use '(pwd)'.
replay "export TEST=$(pwd)"

Fails on env vars with quotes

Hi! First of all, I would like to thank you for this nice tool. I ran into an issue today when using it in a nix shell. This shell sets a variable $shellHook which has quotes (specifically ") in it, which results in replay printing some part of the value of $shellHook.

I didn't manage to reproduce the printing, but there is definitely something wrong with quotes handling:

$ replay 'export TEST=\'echo "hi"\''
$ echo $TEST
echo hi

Quotes around hi are missing. I played around a little myself and this seems to fix the issue:

36c36,37
<                             echo "set --global --export $name \"$value\""
---
>                             set --local tmp (string replace --all \" \\\" $value)
>                             echo "set --global --export $name \"$tmp\""

I would make a PR, but I don't know enough about how replay works to know if there are problems with this or other changes are needed.

Error with multiline variable and `${VARIABLE}` notation: "Expected a variable name after this $"

Given a file hook.sh:

export shellHook='"${DIRENV_IN_ENVRC}"
'

Then, replay . hook.sh errors:

$ replay . hook.sh
- (line 1): Expected a variable name after this $.
set --global --export shellHook \"\\$\{DIRENV_IN_ENVRC\}\"\
                                    ^
from sourcing file -
        called on line 25 of file ~/.config/fish/fundle/jorgebucaran/replay.fish/functions/replay.fish
in function 'replay' with arguments '. hook.sh'
source: Error while reading file '<stdin>'

I'm not sure what exactly causes this bug, but it seems to be the combination of a multiline variable and the braced ${VARIABLE} notation.

I assume part of this bug is from the complexity of escaping in replay.fish: first the variable contents are passed to string escape, then piped through string replace --all -- \$ \\\$, then through string replace --all -- \\n \n.

After inserting some debugging statements, it looks like this is what's sourced in fish:

set --global --export shellHook \"\\$\{DIRENV_IN_ENVRC\}\"\

And we can confirm:

$ string escape -- '"${DIRENV_IN_ENVRC}"\\n' | string replace --all -- \$ \\\$ | string replace --all -- \\n \n
\"\\$\{DIRENV_IN_ENVRC\}\"\

I'm not actually sure what the string replace --all \$ \\\$ bit is for; maybe it's relevant for other lines?

Import bash completions

A lot of tools still don't have fish completions but do have bash completions. It would be cool to be able to write something like this in config.fish:

replay source /usr/local/etc/bash_completion.d/flutter.bash

to source bash completions.

Sometimes breaks on parentheses in PATH

Minimal example:

set PATH "(foo)" $PATH
replay 'PATH=bar:$PATH'

The problem seems to be on Line 33, which will yield the string set PATH (foo) ....

This particular issue could be fixed by replacing Line 33 with the following:

string replace --all ')' '\)' (string replace --all '(' '\(' (string replace --all : " " "set $name $value"))

Not sure whether this is the best solution, though.

Help wanted - problems sourcing nix files…

I'm using bax to source nix on a Mac. I have this:

if test -e '/Users/viktor/.nix-profile/etc/profile.d/nix.sh'
  bax source '/Users/viktor/.nix-profile/etc/profile.d/nix.sh'
end

That's a general setup-file for nix that looks like this:

if [ -n "$HOME" ] && [ -n "$USER" ]; then

    # Set up the per-user profile.
    # This part should be kept in sync with nixpkgs:nixos/modules/programs/shell.nix

    NIX_LINK=$HOME/.nix-profile


    # Append ~/.nix-defexpr/channels to $NIX_PATH so that <nixpkgs>
    # paths work when the user has fetched the Nixpkgs channel.
    export NIX_PATH=${NIX_PATH:+$NIX_PATH:}$HOME/.nix-defexpr/channels

    # Set up environment.
    # This part should be kept in sync with nixpkgs:nixos/modules/programs/environment.nix
    export NIX_PROFILES="/nix/var/nix/profiles/default $HOME/.nix-profile"

    # Set $NIX_SSL_CERT_FILE so that Nixpkgs applications like curl work.
    if [ -e /etc/ssl/certs/ca-certificates.crt ]; then # NixOS, Ubuntu, Debian, Gentoo, Arch
        export NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
    elif [ -e /etc/ssl/ca-bundle.pem ]; then # openSUSE Tumbleweed
        export NIX_SSL_CERT_FILE=/etc/ssl/ca-bundle.pem
    elif [ -e /etc/ssl/certs/ca-bundle.crt ]; then # Old NixOS
        export NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt
    elif [ -e /etc/pki/tls/certs/ca-bundle.crt ]; then # Fedora, CentOS
        export NIX_SSL_CERT_FILE=/etc/pki/tls/certs/ca-bundle.crt
    elif [ -e "$NIX_LINK/etc/ssl/certs/ca-bundle.crt" ]; then # fall back to cacert in Nix profile
        export NIX_SSL_CERT_FILE="$NIX_LINK/etc/ssl/certs/ca-bundle.crt"
    elif [ -e "$NIX_LINK/etc/ca-bundle.crt" ]; then # old cacert in Nix profile
        export NIX_SSL_CERT_FILE="$NIX_LINK/etc/ca-bundle.crt"
    fi

    if [ -n "${MANPATH-}" ]; then
        export MANPATH="$NIX_LINK/share/man:$MANPATH"
    fi

    export PATH="$NIX_LINK/bin:$PATH"
    unset NIX_LINK
fi

What's failing is:

export NIX_PATH=${NIX_PATH:+$NIX_PATH:}$HOME/.nix-defexpr/channels

The other env is correctly exported but just NIX_PATH is not.

Current workaround is just to do:

if test -e '/Users/viktor/.nix-profile/etc/profile.d/nix.sh'
  set -x NIX_PATH $NIX_PATH $HOME/.nix-defexpr/channels
  bax source '/Users/viktor/.nix-profile/etc/profile.d/nix.sh'
end

Sorry to report as a bug here, because I think it's just nix preference for bash that's troubling here, but maybe you have some insight?

Rename Bax to Replay

Replay is more clear about what this tool does. Bax isn't. That's the only reason. Fisher 4.x makes the transition easy too:

fisher remove jorgebucaran/bax.fish && fisher install jorgebucaran/replay.fish

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.