Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't seem to get it to work #11

Open
cameronr opened this issue Oct 6, 2024 · 2 comments
Open

Can't seem to get it to work #11

cameronr opened this issue Oct 6, 2024 · 2 comments

Comments

@cameronr
Copy link

cameronr commented Oct 6, 2024

I followed the "zinit without zinit-annex-bin-gem-node" instructions and the script runs by itself but I can't seem to get it actually process a file correctly:

zsweep --auto zsh/get-icon-for-command.zsh
[ZSweep][zs::get-prj-dir:46]: Warning: didn't find any main poject dir uptree, was looking for: ·.git, ·TAGS, ·tags, ·CMakeLists.txt, ·configure

[ZSweep][zsweep:65]: Notice: scanning file: •ZSH/GET-ICON-FOR-COMMAND.ZSH•…

[ZSweep][zs::get-prj-dir:46]: Warning: didn't find any main poject dir uptree, was looking for: ·.git, ·TAGS, ·tags, ·CMakeLists.txt, ·configure
[ZSweep][zs::read-file:20]: Error: no input file given
[ZSweep][zsweep:75]: Warning: returning non-zero exit code
[ZSweep][zsweep:76]: Warning: the 1/1 failed files are:
·zsh/get-icon-for-command.zsh

I'm running that script from ~/dotfiles which is a git repo. I traced through that problem and the if at functions/util/zs::get-prj-dir:32 evaluates as true but I don't understand why. This is what set -x shows for that comparison:

[[ /Users/cam/dotfiles/.git == ([[:cntrl:][:space:][:INCOMPLETE:][:INVALID:]]#|*[[:INCOMPLETE:][:INVALID:]]*|[[:cntrl:]]#|0#|[^[:print:][:alnum:]]#) ]]

None of that explains the [ZSweep][zs::read-file:20]: Error: no input file given error.

Any idea what might be going on?

I'm interested to see if it would be possible to get zsweep set up as a zsh linter in nvim via nvim-lint / mason. But I have to get it working first :) Any help much appreciated!

@cameronr
Copy link
Author

cameronr commented Oct 6, 2024

Did a little more digging and this is the comparison in zs::read-file that's evaluating as true even thought it doesn't seem like it should (line numbers off by one from GH src because i added a set -x line):

+util/zs::read-file:20> [[ /Users/cam/dotfiles/zsh/get-icon-for-command.zsh == ([[:cntrl:][:space:][:INCOMPLETE:][:INVALID:]]#|*[[:INCOMPLETE:][:INVALID:]]*|[[:cntrl:]]#|0#|[^[:print:][:alnum:]]#) ]]
+util/zs::read-file:21> zsmsg_ zs::read-file:21 -h '{err}Error:{txt}' no input file given

@cameronr
Copy link
Author

cameronr commented Oct 6, 2024

I'm terrible at pattern matching but perplexity.ai says of that pattern:

The alternative [^[:print:][:alnum:]]# at the end allows for zero occurrences of non-printable, non-alphanumeric characters, which is true for any string (including your path).

Changing the last # to a + in WRONGSTR does seem to let it find the script (and the project directory):

-g:([[:cntrl:][:space:][:INCOMPLETE:][:INVALID:]]#|*[[:INCOMPLETE:][:INVALID:]]*|[[:cntrl:]]#|0#|[^[:print:][:alnum:]]+)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant