AstraLuma / xontrib-z

Tracks your most used directories, based on 'frecency'.
GNU General Public License v3.0
24 stars 16 forks source link

How to excute this package from xonsh script #17

Closed Kidman1670 closed 3 years ago

Kidman1670 commented 3 years ago

When use z in command line its work as normal But when pass to script and excute this script it show error not found this binary xonsh: subprocess mode: command not found: z

Did you mean one of the following?
    w:   Command (/bin/w)
    xz:  Command (/bin/xz)
    7z:  Command (/bin/7z)
    X:   Command (/bin/X)
    uz:  Command (/bin/uz)

I try to find where is z binary with which but don't found, seem like xontrib package not work as a binary or a alone python script file. In /usr/share/python3/.../xontrib/z.py i cannot exexcute it too(and also i require root permission). => In short I want to ask how to pass z to a script

AstraLuma commented 3 years ago

It does not. No xontrib does.

Aliases work like functions in bourne-like shells: they're only available in that session. In addition, any cd'ing done inside of a script would not be reflected in the calling shell.

Xonsh also has rules about when xonshrc is loaded which means that it is probably not loaded inside your script.

You should add a xontrib load to the top of your script for any functionality you need. Many xontribs, however, will only work inside the script and not move outside it. (vox activate, z, scheduling, etc etc)