Should `tea name` be willing to run /usr/bin/name?
I have some arbitrary command named /usr/local/bin/twhich installed. Should this work?
> /opt/tea/tea.xyz/v*/bin/tea twhich
Usage: twhich [ -aIrV ] [ -K command file ] file
Usage: twhich -s -K command [ -aIrV ] file
> twhich
Usage: twhich [ -aIrV ] [ -K command file ] file
Usage: twhich -s -K command [ -aIrV ] file
If it's supposed to work, I'm not sure why. I guess the point of tea is to set up an environment and run any command. But I've bumped into some trouble with this because I was trying to switch from a brew installed tool to a tea installed tool and I couldn't tell which was running. In fact, it was running the brew version because the tea version didn't install like I thought it had.
It is working as intended. Consider adding libraries but using a system compiler. tea +zlib.net gcc main.c should work. tea package paths should be earlier in the path than anything else, which should be confirmable with tea +python.org which -a python.
Ok, I have to remember to do tea which .... I think maybe you told me to do this already. I need to write it down.
Ok, the reason why I've cared about this is actually what is going on in https://github.com/teaxyz/cli/issues/170.
Closing this because #170 is really the problem.
I'm reopening this again because I think it is an issue. The usage says tea [-xdX] [flags] [+package~x.y] [file|URL|target|cmd|interpreter]. I still don't understand all of these options. Maybe we can get examples? The only usages I really understand are tea +pkg cmd and tea -X cmd.
I know tea can download markdown or scripts and execute them, but do you have to have -X? And do those work?
I have no idea what "interpreter" means. Is that tea -X python -c 'print("Hello, World")'? Isn't that really the same as tea -X cmd? Or does it really mean tea python.py or even a script that begins with /usr/local/bin/tea python?
I admit I haven't really gotten into the advanced usage of tea yet. I'm still trying to iron out the basic usage and incorporate it into my daily life. I've been thinking I might be ready to try tea URL.
Anyway, I'm reopening this particular issue because if tea gets extensions and one of them is a community package manager named "pm", then how would a user specify it? tea pm? Or, probably not a good idea, but just an example of a problem, but the package manager could be called brew. So if you called tea brew, then would it execute the extension or Homebrew's brew? Thus why I've reopened the issue.
The reason you might need pass through is this: tea +somelibrary cc -lsome file.c or tea +jq make. Since tea is concerned with more than executables, you might want to run something you already have in a modified environment.
-X is sugar to reduce the difficulty curve for someone to find a binary they might be looking for without knowing the package name.
Yes, interpreter is likely redundant but it's illustrative.
For discoverable commands, I'd probably implement install, upgrade, remove, and cleanup to simulate usual systems package manager functionality as the first pass.
Ok. I am not sure what -x is supposed to mean though. It sounds like "exec" is always the behavior. Is there sometime it's not?
Also, how would you run an extension?
And I am really hoping for a -w for which. Should I open a new issue with it? I'm guessing yes, so I guess I'll do that now.
Yes, interpreter is likely redundant but it's illustrative.
I should take another pass over --help, since last I did it things have evolved somewhat.
tea -d is --dump which is mostly used for virtual environment management, but I intend to flesh it out more.
Honestly -d probably satisfies your needs somewhat @magnusviri, once complete anyway, since it'll show more information about what tea would do in -x mode.
Yes -x, or --exec is the default if you don't specify anything. We imply this in --help but not well.
Anyway, certainly we will improve the ergonomics and --help before 1.0
Sounds good, thanks. I just wanted to make sure I understood, besides -X, is there any time it's not in -x or --exec mode?
k, was shower-thoughtsing this this morning and I'm leaning towards:
tea --dump becomes a tea/cmd (when tea/cmd implemented).
Then we have:
tea foo # magic! installs command or executes it from `PATH` (implicitly is `tea -M foo`)
tea -n foo # dry run, shows what it will do
tea -X foo # only run with tea
tea -m foo # no magic, if `foo` is not in `PATH` fails
We now have -n (alias for --dry-run)
Thanks!
@magnusviri LMK what you think ☺️