BurntSushi / wingo

A fully-featured window manager written in Go.
Do What The F*ck You Want To Public License
1k stars 86 forks source link

Fallback command parser #137

Closed tie closed 6 years ago

tie commented 6 years ago

Added fallback command parser in case shell is not set (or installed on the system). In such case, github.com/mattn/go-shellwords is used for parsing the arguments.

Btw, looks like there is a bug in gribble. It trims quotes from string token strings.Trim(p.TokenText(), "\"`"), so <"\""> input will produce <\>.

BurntSushi commented 6 years ago

Could you please explain why you want this? What is the motivation?

tie commented 6 years ago

Sure. In my opinion, requiring external command interpreter is overkill, mostly because I've never really used any of the shell features inside the X session, e.g., for running piped commands (and I doubt anyone else does this often). And while it is possible to wrap the code from the PR in a standalone executable (with -c flag support), I think it's worth adding some default command parser in the wingo.

BurntSushi commented 6 years ago

Thanks for elaborating. Unfortunately, I don't agree. I think relying on a shell to exist is just fine, and I do not want the extra maintenance burden of a custom shell lexer.

Wingo is in maintenance mode and isn't really actively developed. I do enough to keep the lights on because I still use it. So with that said, if you want this functionality badly enough, I'm going to have to ask you to maintain the patch yourself.

tie commented 6 years ago

Ok, that's fine with me. What about the gribble parser?

Btw, looks like there is a bug in gribble. It trims quotes from string token strings.Trim(p.TokenText(), "\"`"), so <"\""> input will produce <\>.

This line does not look like an expected behavior. There is even a workaround in wingo's code. I'd rather use strconv.Unquote instead of strings.Trim for this purpose, but the fix will require removing workaround from wingo anyway.

Should I create an issue in gribble's repository?

BurntSushi commented 6 years ago

Is the bug actually impacting you?

I cannot understate how conservative I am with changes to Wingo. There is no test suite, so my default reaction to any proposed change is to not do it.

tie commented 6 years ago

Got it. The workaround works just fine in most cases, so if you don't want to make changes, it's ok to leave everything as it is now. Thanks for your replies.