Skip to content

Conversation

@bbadour
Copy link

@bbadour bbadour commented Nov 26, 2025

Include an empty argument and all subsequent arguments.

What type of PR is this?

  • bug

What this PR does / why we need it:

Sometimes command line arguments are empty strings.

i.e.

command subcommand '' 'anotherarg'

Which issue(s) this PR fixes:

Fixes #2234

Release Notes

Allow empty command line arguments. i.e. "", '' etc.

bbadour and others added 4 commits November 21, 2025 18:23
Use delegation to implement the Value+Flag paradigm used for other flag
types.

Implement all of the Flag interfaces except Count.

Borrowed heavily from flag_bool.go and flag_generic.go

Add context to the error message when setting an external flag's value
to its default value to avoid cryptic error messages like:
`"syntax error: expected file.go:234"`

And suppress the error for odd-ball external flags that report the
string representation of the zero-value of some structure as the
default, but do not accept that string as input. Detect such odd-balls
by their `Get()` method returning `nil`.
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps the python-packages group with 1 update: [mkdocs-material](https://github.com/squidfunk/mkdocs-material).

Updates `mkdocs-material` from 9.6.23 to 9.7.0
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](squidfunk/mkdocs-material@9.6.23...9.7.0)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-version: 9.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
...

Signed-off-by: dependabot[bot] <support@github.com>
Include an empty argument and all subsequent arguments.
@bbadour bbadour requested a review from a team as a code owner November 26, 2025 21:36
// skip test flags
if !strings.HasPrefix(f.Name, ignoreFlagPrefix) {
cmd.Flags = append(cmd.Flags, &extFlag{f})
cmd.Flags = append(cmd.Flags, &extFlag{f, ""})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this change from this PR.

package cli

import "flag"
import (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this from PR

@dearchap
Copy link
Contributor

@bbadour try to focus on one issue per PR.

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.

An empty argument and all subsequent arguments are dropped

2 participants