Skip to content

feat(cli): accept a bare --commit flag with the hash before it - #19

Open
Iamliuxiaozhen wants to merge 1 commit into
mainfrom
feat/commit-hash-before-flag
Open

Iamliuxiaozhen wants to merge 1 commit into
mainfrom
feat/commit-hash-before-flag

Conversation

@Iamliuxiaozhen

Copy link
Copy Markdown
Member

A hash is now accepted both before and after the flag:

patchsplit --commit
patchsplit --commit

A bare --commit selects commit mode and takes the last positional as the hash, so nothing becomes ambiguous with a pull request number: the flag itself marks the trailing argument as a commit hash. GitLab projects with subgroups work the same way.

The parser no longer swallows a following option as the option value, so --commit --force reports a missing value instead of treating "--force" as a hash.

Refs: #18

A hash is now accepted both before and after the flag:

  patchsplit <owner> <repo> <hash> --commit
  patchsplit <owner> <repo> --commit <hash>

A bare `--commit` selects commit mode and takes the last positional as the
hash, so nothing becomes ambiguous with a pull request number: the flag
itself marks the trailing argument as a commit hash. GitLab projects with
subgroups work the same way.

The parser no longer swallows a following option as the option value, so
`--commit --force` reports a missing value instead of treating "--force" as
a hash.

Refs: #18
@lingbopro

Copy link
Copy Markdown
Contributor

Then we can make the second argument accept both PR number and commit hash, and (optionally) with an optional --commit flag to prevent ambiguity:

patchsplit <owner/repo> <pr-number> [options]
patchsplit <owner/repo> <commit-hash> [options]
patchsplit <owner/repo> <commit-hash> --commit [options]

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 this pull request may close these issues.

2 participants