mjackson / mjackson/optionparser
Short flags without spaces
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 30
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
This library cannot parse short options passed without spaces between the flag and the value. For an example, I use cp:
$ touch testfile
$ mkdir testdir
$ cp testfile -ttestdir
$ ls testdir/
testfile
Where '-t' is the short option (to directory).
The current version of the library, given the same rule ('t'), will fail when it encounters the first letter of the parameter that doesn't have a corresponding rule. In this case, possibly 'e'. Additionally, the regex matching for a more complex case in the same vein will fail when any character other than a-z and '-' is encountered, such as a hostname or url. (-hexample.domain.com).
This is complicated by the fact that this is easy to apply to short flags that require a parameter. Optional parameters, however, would require additional checking to see if the current token is a listing of short flags or a short flag with parameter.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the short-option parsing and regex logic, then reproduce the cp testfile -ttestdir example described in the issue. The fix is done when short flags requiring parameters accept attached values, including hostnames or URLs, while optional-parameter handling remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100