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

Shell completions are corrupted. #62

Closed
igo95862 opened this issue May 5, 2021 · 6 comments · Fixed by #69
Closed

Shell completions are corrupted. #62

igo95862 opened this issue May 5, 2021 · 6 comments · Fixed by #69

Comments

@igo95862
Copy link
Contributor

igo95862 commented May 5, 2021

Screenshot from 2021-05-05 10-09-33

All of shell completions have this binary string at the end.

In less it looks like this:

ESC(BESC[m

Probably an issue with upstream library?

@Foxboron
Copy link
Owner

Foxboron commented May 9, 2021

This is an inherent issue with how I have implemented the terminal colors. All commands are closed off with that escape code for no good reason.

https://github.com/Foxboron/sbctl/blob/master/cmd/sbctl/main.go#L352

I should try and implement the new command structure with the cli output to fix this :/ Is it completely broken with fish? zsh works fine with the escape at the bottom.

@igo95862
Copy link
Contributor Author

igo95862 commented May 9, 2021

Is it completely broken with fish?

Yes. Fish is strict about script formatting.

@igo95862
Copy link
Contributor Author

igo95862 commented May 9, 2021

BTW. Why not write to some file directly instead of stdout? Probably avoids the issue but require slight PKGBUILD modification.

@Foxboron
Copy link
Owner

Foxboron commented May 9, 2021

I think generally restructuring the AddCommand section to add PostRun with the off switch on everything except the completion stuff is the way to go.

@igo95862
Copy link
Contributor Author

I think it is also possible to send control sequences in to stderr instead of stdout. Usually but will be linked to same pipe as stdout but in case of shell redirect > only stdout will be redirected.

@igo95862
Copy link
Contributor Author

Ok. I tested changing fmt.Print(off) to fmt.Fprint(os.Stderr, off) and it works. Shell scripts are no longer corrupted and colors are still displayed. This is a one line change.

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

Successfully merging a pull request may close this issue.

2 participants