Biont / shellm

A one-file Ollama CLI client written in bash
GNU General Public License v3.0
19 stars 1 forks source link

Inavlid arithmetic #1

Open Pipboyguy opened 3 weeks ago

Pipboyguy commented 3 weeks ago
❯ shellm -v "Debug the script behavior."
jq: error (at <stdin>:1): null (null) has no keys
/usr/local/bin/shellm: line 78: TOOLS["$(echo "$tool" | jq -r '.key')"]: bad array subscript
/usr/local/bin/shellm: line 44: [[: Debug the script behavior.: syntax error: invalid arithmetic operator (error token is ".")
/usr/local/bin/shellm: line 45: [[: Debug the script behavior.: syntax error: invalid arithmetic operator (error token is ".")
/usr/local/bin/shellm: line 46: [[: Debug the script behavior.: syntax error: invalid arithmetic operator (error token is ".")
/usr/local/bin/shellm: line 47: [[: Debug the script behavior.: syntax error: invalid arithmetic operator (error token is ".")
/usr/local/bin/shellm: line 44: [[: Debug the script behavior.: syntax error: invalid arithmetic operator (error token is ".")
Biont commented 2 weeks ago

Hi! The script expects a numeric log level, like -v 3

I probably need to improve the error handling and docs on this

Pipboyguy commented 2 weeks ago

ahh! Thanks @Biont

Pipboyguy commented 2 weeks ago
❯ shellm -v 3 "Debug the script behavior."
jq: error (at <stdin>:1): null (null) has no keys
/usr/local/bin/shellm: line 78: TOOLS["$(echo "$tool" | jq -r '.key')"]: bad array subscript

It works now! but still getting the warning

Biont commented 2 weeks ago

I'll check it out asap. Thanks for your patience. I'm still experimenting a lot here

Biont commented 2 weeks ago

@Pipboyguy Currently, the README fails to mention that the script now expects the config file to be present. When I created the readme, the config file was only used for customization/overrides, but I have since moved many of the prompts in there to save space.

So it errors if the config is not there. To fix it, you can just download the config YAML and place it in one of the recognized paths

I will try to make the following changes as soon as I find the time:

  1. Update the README
  2. Bail if no config is found on startup
  3. If no file is found, ask if it shall be downloaded from GH (<- this might be a bonus I'm skipping)
danchev commented 1 week ago
❯ shellm -v 3 "Debug the script behavior."
jq: error (at <stdin>:1): null (null) has no keys
/usr/local/bin/shellm: line 78: TOOLS["$(echo "$tool" | jq -r '.key')"]: bad array subscript

It works now! but still getting the warning

@Pipboyguy I encountered the same issue and after some investigation, it appears that this project relies on yq, but there are at least two distinct tools with the same name. In my case only the Python-based yq (v3.4.3) was able to parse the config file correctly.

Here are the links to both projects: mikefarah/yq (v4.44.3) kislyuk/yq (v3.4.3)