Code Monkey home page Code Monkey logo

Comments (7)

Wabri avatar Wabri commented on July 24, 2024

Instead of creating an alias on bash profile, we can create a softlink in the usr/local/bin directory and name it yapi. Something like this:

sudo ln -s ~/YAPI/yapi.sh /usr/local/bin/yapi

with this you can call yapi even if you use zsh or a launcher.

from yapi.

IanDuncanT avatar IanDuncanT commented on July 24, 2024

I did not know about softlinking. This would be easier and I am going to change that to run. Does this need to run on every boot or terminal startup, similar to how alias is, or does it persist across boots?

from yapi.

IanDuncanT avatar IanDuncanT commented on July 24, 2024

I have tried this, however there is no change as python can't start from the softlink or alias.

from yapi.

Wabri avatar Wabri commented on July 24, 2024

You're right, this is because the YAPI files used are all in a directory and the python code refers to non-absolute paths so if you even alias (or create soft link) yapi.sh (or yapi.py) when you call it outside of the yapi directory will not work because the paths are wrong.
I arrived at this by doing some tests.
First of all I changed the yapi.sh like this:

cd ~/git/YAPI
python3 ~/git/YAPI/yapi.py $1 $2

Then create the softlink and i try to run it:
hay

With these changes it works, but I dont know if this is worth it. What do you think?

from yapi.

IanDuncanT avatar IanDuncanT commented on July 24, 2024

I think this is fine. If you need, you can get current path with os and append the relative path. This could help running, but your solution should work. The only question I have is if subprocess is in a new terminal and would need to cd into the correct directory.

from yapi.

Wabri avatar Wabri commented on July 24, 2024

If yapi.sh have this line:
https://github.com/YetAnotherPackageInstaller/YAPI/blob/ede201b7a08efce71479ba271c458ec816fa4261/yapi.sh#L1
the problem no longer exists.

from yapi.

Wabri avatar Wabri commented on July 24, 2024

Yes this is not the right method to handle this problem, but for now this is the easiest way. I will open a new issue for this new problem: "set up absolute path"

from yapi.

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.