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

Tide breaks the ability to "cd" to directories starting with "- " #88

Closed
jeremymeyers opened this issue Feb 4, 2021 · 5 comments
Closed
Labels
🐛 bug Something isn't working

Comments

@jeremymeyers
Copy link

Describe the bug

Attempts to either cd or move around in directories that start with "- " fail with an error state listed below. This does not happen with a clean 'fish' shell.

Steps to reproduce

  1. Create a directory starting with "- " e.g. "/Volumes/movies/- downloaded teevee"
  2. enter "cd /Volumes/movies/- downloaded teevee" either manually or using the autocomplete
  3. Get error state that repeats a bunch of times:
 ~ cd /Volumes/movies/-\ downloaded\ teevee/                                                                                                      ✔  05:30:03 PM 
 ~ string join: Unknown option '- downloaded teevee'                                                                                              ✔  05:30:09 PM 

~/.config/fish/functions/_tide_item_pwd.fish (line 1): 
string join '/' $splitPwdForLength | string length
^
in command substitution
	called on line 25 of file ~/.config/fish/functions/_tide_item_pwd.fish
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help string' for related documentation)
test: Missing argument at index 2

~/.config/fish/functions/_tide_item_pwd.fish (line 25): 
        else if test (string join '/' $splitPwdForLength | string length) -gt $pwdMaxLength
                ^
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help test' for related documentation)
 /Volumes/movies/- downloaded teevee string join: Unknown option '- downloaded teevee'                                                             ✔  05:30:11 PM 

~/.config/fish/functions/_tide_item_pwd.fish (line 1): 
string join '/' $splitPwdForLength | string length
^
in command substitution
	called on line 25 of file ~/.config/fish/functions/_tide_item_pwd.fish
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help string' for related documentation)
test: Missing argument at index 2

~/.config/fish/functions/_tide_item_pwd.fish (line 25): 
        else if test (string join '/' $splitPwdForLength | string length) -gt $pwdMaxLength
                ^
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help test' for related documentation)
string join: Unknown option '- downloaded teevee'

~/.config/fish/functions/_tide_item_pwd.fish (line 1): 
string join '/' $splitPwdForLength | string length
^
in command substitution
	called on line 25 of file ~/.config/fish/functions/_tide_item_pwd.fish
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help string' for related documentation)
test: Missing argument at index 2

~/.config/fish/functions/_tide_item_pwd.fish (line 25): 
        else if test (string join '/' $splitPwdForLength | string length) -gt $pwdMaxLength
                ^
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help test' for related documentation)
 /Volumes/movies/- downloaded teevee string join: Unknown option '- downloaded teevee'                                                                ✔  05:30:12 PM 

~/.config/fish/functions/_tide_item_pwd.fish (line 1): 
string join '/' $splitPwdForLength | string length
^
in command substitution
	called on line 25 of file ~/.config/fish/functions/_tide_item_pwd.fish
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help string' for related documentation)
test: Missing argument at index 2

~/.config/fish/functions/_tide_item_pwd.fish (line 25): 
        else if test (string join '/' $splitPwdForLength | string length) -gt $pwdMaxLength
                ^
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help test' for related documentation)
 /Volumes/movies/- downloaded teevee string join: Unknown option '- downloaded teevee'                                                                 ✔  05:30:12 PM 

~/.config/fish/functions/_tide_item_pwd.fish (line 1): 
string join '/' $splitPwdForLength | string length
^
in command substitution
	called on line 25 of file ~/.config/fish/functions/_tide_item_pwd.fish
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help string' for related documentation)
test: Missing argument at index 2

~/.config/fish/functions/_tide_item_pwd.fish (line 25): 
        else if test (string join '/' $splitPwdForLength | string length) -gt $pwdMaxLength
                ^
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help test' for related documentation)
string join: Unknown option '- downloaded teevee'

~/.config/fish/functions/_tide_item_pwd.fish (line 1): 
string join '/' $splitPwdForLength | string length
^
in command substitution
	called on line 25 of file ~/.config/fish/functions/_tide_item_pwd.fish
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help string' for related documentation)
test: Missing argument at index 2

~/.config/fish/functions/_tide_item_pwd.fish (line 25): 
        else if test (string join '/' $splitPwdForLength | string length) -gt $pwdMaxLength
                ^
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help test' for related documentation)
 /Volumes/movies/- downloaded teevee string join: Unknown option '- downloaded teevee'                                                                   ✔  05:30:12 PM 

~/.config/fish/functions/_tide_item_pwd.fish (line 1): 
string join '/' $splitPwdForLength | string length
^
in command substitution
	called on line 25 of file ~/.config/fish/functions/_tide_item_pwd.fish
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help string' for related documentation)
test: Missing argument at index 2

~/.config/fish/functions/_tide_item_pwd.fish (line 25): 
        else if test (string join '/' $splitPwdForLength | string length) -gt $pwdMaxLength
                ^
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help test' for related documentation)
 /Volumes/movies/- downloaded teevee string join: Unknown option '- downloaded teevee'                                                                     ✔  05:30:12 PM 

~/.config/fish/functions/_tide_item_pwd.fish (line 1): 
string join '/' $splitPwdForLength | string length
^
in command substitution
	called on line 25 of file ~/.config/fish/functions/_tide_item_pwd.fish
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help string' for related documentation)
test: Missing argument at index 2

~/.config/fish/functions/_tide_item_pwd.fish (line 25): 
        else if test (string join '/' $splitPwdForLength | string length) -gt $pwdMaxLength
                ^
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help test' for related documentation)
 /Volumes/movies/- downloaded teevee string join: Unknown option '- downloaded teevee'                                                                      ✔  05:30:12 PM 

~/.config/fish/functions/_tide_item_pwd.fish (line 1): 
string join '/' $splitPwdForLength | string length
^
in command substitution
	called on line 25 of file ~/.config/fish/functions/_tide_item_pwd.fish
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help string' for related documentation)
test: Missing argument at index 2

~/.config/fish/functions/_tide_item_pwd.fish (line 25): 
        else if test (string join '/' $splitPwdForLength | string length) -gt $pwdMaxLength
                ^
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help test' for related documentation)
 /Volumes/movies/- downloaded teevee string join: Unknown option '- downloaded teevee'                                                                       ✔  05:30:12 PM 

~/.config/fish/functions/_tide_item_pwd.fish (line 1): 
string join '/' $splitPwdForLength | string length
^
in command substitution
	called on line 25 of file ~/.config/fish/functions/_tide_item_pwd.fish
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help string' for related documentation)
test: Missing argument at index 2

~/.config/fish/functions/_tide_item_pwd.fish (line 25): 
        else if test (string join '/' $splitPwdForLength | string length) -gt $pwdMaxLength
                ^
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help test' for related documentation)
string join: Unknown option '- downloaded teevee'

~/.config/fish/functions/_tide_item_pwd.fish (line 1): 
string join '/' $splitPwdForLength | string length
^
in command substitution
	called on line 25 of file ~/.config/fish/functions/_tide_item_pwd.fish
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help string' for related documentation)
test: Missing argument at index 2

~/.config/fish/functions/_tide_item_pwd.fish (line 25): 
        else if test (string join '/' $splitPwdForLength | string length) -gt $pwdMaxLength
                ^
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help test' for related documentation)
 /Volumes/movies/- downloaded teevee string join: Unknown option '- downloaded teevee'                                                                        ✔  05:30:12 PM 

~/.config/fish/functions/_tide_item_pwd.fish (line 1): 
string join '/' $splitPwdForLength | string length
^
in command substitution
	called on line 25 of file ~/.config/fish/functions/_tide_item_pwd.fish
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help string' for related documentation)
test: Missing argument at index 2

~/.config/fish/functions/_tide_item_pwd.fish (line 25): 
        else if test (string join '/' $splitPwdForLength | string length) -gt $pwdMaxLength
                ^
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help test' for related documentation)
string join: Unknown option '- downloaded teevee'

~/.config/fish/functions/_tide_item_pwd.fish (line 1): 
string join '/' $splitPwdForLength | string length
^
in command substitution
	called on line 25 of file ~/.config/fish/functions/_tide_item_pwd.fish
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help string' for related documentation)
test: Missing argument at index 2

~/.config/fish/functions/_tide_item_pwd.fish (line 25): 
        else if test (string join '/' $splitPwdForLength | string length) -gt $pwdMaxLength
                ^
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help test' for related documentation)
 /Volumes/movies/- downloaded teevee                                                                                                                          ✔  05:30:12 PM 

Alternately:
2. Launch a terminal window from finder within a directory starting with "- "
3. Error displayed when rendering prompt:

   string join: Unknown option '- downloaded teevee'                                                                              ✘ 1  15m 57s  05:23:07 PM 

~/.config/fish/functions/_tide_item_pwd.fish (line 1): 
string join '/' $splitPwdForLength | string length
^
in command substitution
	called on line 25 of file ~/.config/fish/functions/_tide_item_pwd.fish
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help string' for related documentation)
test: Missing argument at index 2

~/.config/fish/functions/_tide_item_pwd.fish (line 25): 
        else if test (string join '/' $splitPwdForLength | string length) -gt $pwdMaxLength
                ^
in function '_tide_item_pwd'
	called on line 1 of file ~/.config/fish/functions/_tide_left_prompt.fish
in command substitution
	called on line 11 of file ~/.config/fish/functions/_tide_left_prompt.fish
in function '_tide_left_prompt'
	called on line 13 of file ~/.config/fish/functions/_tide_prompt.fish
in function '_tide_prompt'
in command substitution

(Type 'help test' for related documentation)
 /Volumes/movies/- downloaded teevee  

Expected behavior

Screenshots

Environment (please complete the following information)

  • Operating System: Terminal in MacOS 10.15.7
  • Output of tide bug-report:
 ~ tide bug-report                                                                                                                                            ✔  05:32:21 PM 
fish, version 3.1.2
tide, version 4.0.0
xterm-256color
 ~   

Additional context

@jeremymeyers jeremymeyers added the 🐛 bug Something isn't working label Feb 4, 2021
@IlanCosman
Copy link
Owner

Yah. This is one of those places where Unix should have just disallowed the character at the start of the string. I'll fix it, but please just don't create any directories like that 😂 You'll notice that trying to cd into it from the parent directory won't work. cd -foo/ has to be replaced with cd -- -foo/. It's just an all around bad time that should be avoided.

@jeremymeyers
Copy link
Author

If you can tell me a better way to have multiple OS' list a directory at the beginning of an alphabetical sort that isn't putting a non-alpha character in front of it/them, then I'd be happy to implement that method. Thanks for fixing the error!

@IlanCosman
Copy link
Owner

IlanCosman commented Feb 9, 2021

Sure. ! comes even before -, and it's much less likely to mess with shells. https://theasciicode.com.ar/

@Veraellyunjie
Copy link

Veraellyunjie commented Apr 11, 2022

Same issue, again. The fix has broken.
Now, the _tide_pwd.fish
has 2 string join -- /... with --
and 2 string join /... without --

@IlanCosman
Copy link
Owner

@Veraellyunjie Please open a new bug report, this is far too old to be of any use.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants