vast-ai / vast-python

Vast.ai python and cli api client
MIT License
123 stars 48 forks source link

Fixes #138 adds tab completion #139

Closed kristopolous closed 3 weeks ago

kristopolous commented 4 weeks ago

This should be completely backwards compatible and gracefully degrade on systems without the pip library installed.

kristopolous commented 3 weeks ago

This is correct. The right way to fix this is to rearrange how the fundamental parsing works. There may be more aggressive ways to hide the slash but the invocation of say, attach ssh is

$ vastai "attach ssh" "instance-id" "key"

and not

$ vastai "attach" "ssh" "instance-id" "key"

Which would be the actual fix. Forcing "attach ssh" to be equivalent to "attach" "ssh" as in, no escaped space, requires multiple hacks ... it's possible but imho it's not worth it. After type "vastai attach " the parser is looking for options associated with the command "vastai attach" because the space is a field separator that means "next argument" not just an appending of the search token. That is, unless you escape it, like so

$ vastai attach\ ssh

Which is what it's trying to do. The only other fix is to change how argument parsing works between the first and second space delimited word - sometimes, except in the case where it's one word. This is once again, not really worth it.

kristopolous commented 3 weeks ago

I'd of course be happy to do it after I exhaust my queue of more relevant tasks unless you think this is a deal-breaker.