mjackson / mjackson/optionparser

Short flags without spaces

Open
#4 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.