Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

Properly require spaces between arguments #8

Open
dgw opened this issue Jan 9, 2016 · 0 comments
Open

Properly require spaces between arguments #8

dgw opened this issue Jan 9, 2016 · 0 comments
Assignees

Comments

@dgw
Copy link
Owner

dgw commented Jan 9, 2016

The changes that caused #7 had to be nerfed because they were too good at finding spaces. But spaces should still be required between arguments.

Broken arg-parsing resulted from the code parsing an argument out of the middle and then also removing the spaces on both sides of it, so subsequent matches would usually fail because of the use of \s+. What's needed is enforcing the spaces (or line start/end) in order to match an argument, but making sure to leave one space when the parsed argument is removed from the input. (This may necessitate trim()'ing the search string before calling the AniTV API.)

Alternatively? Don't remove the args from the input as they're parsed. That could be a way toward better predictability.

I guess the real solution would be to actually parse the arguments (say, by tokenization), but whether implemented from scratch or imported from an existing library, that's a lot of effort and maybe even another dependency that shouldn't really be added.

@dgw dgw added the enhancement label Jan 9, 2016
@dgw dgw self-assigned this Jan 9, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant