Coder Social home page Coder Social logo

Comments (3)

sorokine avatar sorokine commented on June 12, 2024 1

There are many cases when it's hard to detect which shell the program is running under like in Unix-like environments on Windows, none-interactive shells, SHELL variable is not set correctly, etc. As for checking for the basename, I am not even sure that it would work on Windows (anyway, better to use os.path.basename because it takes into account OS path name conventions).

There is also a case of none-interactive installs when the current shell name is irrelevant. I think it would be better to implement an argument to --install-integration option to specify the indented shell, e.g., --install-integration [bash|zsh]. Then if the argument is omitted try to guess the shell. shellingham does a good job of poking around to guess the shell but other solution are also possible.

from shell_gpt.

sorokine avatar sorokine commented on June 12, 2024

Properly detecting shell can be tricky. The best option is to use a dedicated package like shellingham. I did it in my fork but cannot pass the tests: https://github.com/sorokine/shell_gpt

from shell_gpt.

slacksystem avatar slacksystem commented on June 12, 2024

Couldn't it just check for the basename? i.e.

if shell.split("/")[-1] == "zsh":

and

elif shell.split("/")[-1] == "bash":

This would allow for it to work with zsh or bash regardless of where it is installed, and unless I'm mistaken the capability of the integrations doesn't depend on the path of the shell binary, it just has to be zsh or bash.

from shell_gpt.

Related Issues (20)

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.