Skip to content

Shell Integration Not Working on Fish Shell #17

Open

Description

@jubinmytheen

Hi

We are trying to integrate the shell to run the dev command. But unfortunately the shell integration is not working on fish shell.
Is there any way to integrate it on fish shell??

Activity

  1. mxcl commented on Nov 2, 2023

    @mxcl
    Contributor

    This is being built pkgxdev/pkgx#838, help welcome as I am not familiar with fish.

  2. philipgiuliani commented on Nov 9, 2023

    @philipgiuliani

    Whats missing in pkgxdev/pkgx#838 for the task to be complete?

  3. mxcl commented on Nov 9, 2023

    @mxcl
    Contributor

    Been a week so i don't recall precisely (sadly I am super busy with CEO duties RN)

    If you checkout the code and try to SHELL=fish eval deno task run --shellcode we then need the shellcode functions to work

    $ x  # most complex, partially working
    $ env +foo   # should be easy
    $ dev  # again should be pretty easy

    I should be able to resume work on this next week, but feel free to get it working.

    IMO if x works that's enough for now, we can then make dev work after. But as said dev is probs easiest.

    All the code is in shellcode.ts

  4. JanPokorny commented on Mar 21, 2024

    @JanPokorny

    A partial workaround for fish is to use direnv. Install it, and drop a file .envrc with the following content in your project folder:

    source <(pkgx --internal.activate $(realpath .))
    

    This will act very similarly to the dev command -- it will resolve the environment and activate it using pkgx, and deactivate it once you navigate outside of the folder. This should even have greater IDE support since direnv has been around for a while and has battle-tested extensions for most IDEs.

  5. JanPokorny commented on May 13, 2024

    @JanPokorny

    Here's a "poor man's" implementation for the shell integration in Fish:

    function x; bass source (pkgx +(string split -f1 ' ' $history[1]) | psub) && eval $history[1]; end;
    function envx; bass source (pkgx "$argv" | psub); end;
    function dev; bass source (pkgx --internal.activate $(realpath .) | psub); end;
    

    It depends on https://github.com/edc/bass for sourcing bash scripts, and the dev command does not auto-deactivate (it's probably doable with function ... --on-variable PWD -- https://fishshell.com/docs/current/cmds/function.html -- but that would be harder to serve through bass given that it does not port over bash functions -- as said above, I recommend using direnv for this use case). env is called envx not to bother with Unix env compatibility.

  6. svenjacobs commented on May 13, 2024

    @svenjacobs

    @JanPokorny Thanks for the workaround with direnv. Unfortunately this requires a .envrc file in every project folder.

    Looking forward to a native Fish solution as I would like to give this shell a try. Unfortunately I have no experience with Fish and its scripting so I can't help here.

  7. JanPokorny commented on May 13, 2024

    @JanPokorny

    @svenjacobs You could just run echo 'source <(pkgx --internal.activate $(realpath .))' >>.envrc && echo '.envrc' >>.git/info/exclude in every project folder and be done with it. You could alias it to dev-setup or something and just use that instead of dev.

  8. svenjacobs commented on May 14, 2024

    @svenjacobs

    Sure, but I don't want to add a file to every project that my colleagues don't need 😉 Of course I could add the file to the global .gitignore but as I said a native solution would be much appreciated 😃

  9. JanPokorny commented on May 14, 2024

    @JanPokorny

    @svenjacobs The snippet I posted above adds the file to a local ignore file .git/info/exclude

  10. transferred this issue frompkgxdev/pkgxon Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions