Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make trim space optional #1675

Merged
merged 4 commits into from Feb 1, 2023
Merged

Make trim space optional #1675

merged 4 commits into from Feb 1, 2023

Conversation

palsivertsen
Copy link

@palsivertsen palsivertsen commented Jan 31, 2023

What type of PR is this?

  • feature

What this PR does / why we need it:

This PR makes trimming space from string slice values optional (opt in) to not break backward compatibility.

See discussion from #1649 (comment) and onwards.

Which issue(s) this PR fixes:

Fixes #1648

Testing

  • Modified existing test to use new flag.
  • Added test that verifies changes only take effect if field is set (opt in), thus avoiding breaking existing code/usage.
  • Test the behavior for values from the environment.

Release Notes

Add new field `KeepSpace` to `StringSliceFlag` struct. Setting this field will keep leading and tailing spaces when parsing flags.

This adds a new field to the `FlagStringSlice` struct for controlling
the trimming of space when parsing arguments. The new field is called
`NoTrimSpace` and trims space by default. This is to not break existing
programs that depends on this behavior. See
#1649 (comment) for
further details.
This commits addresses the following comment:
#1649 (comment)

String slice flag values from environment now follows the same rules as
parsed values.
@palsivertsen palsivertsen requested a review from a team as a code owner January 31, 2023 18:40
@palsivertsen
Copy link
Author

@skelouse Can you check if this fixes #1649 (comment) ?

@skelouse
Copy link
Contributor

Looks good, although KeepSpaces may be better, as !KeepSpaces is easier to read than !NoTrimSpaces. I'll approve with this change or a valid reason to keep it as NoTrimSpaces

@palsivertsen
Copy link
Author

Agreed

@dearchap dearchap merged commit 4559ae9 into urfave:v2-maint Feb 1, 2023
mudler pushed a commit to kairos-io/provider-kairos that referenced this pull request Feb 6, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/urfave/cli/v2](https://togithub.com/urfave/cli) | require
| patch | `v2.24.2` -> `v2.24.3` |

---

### Release Notes

<details>
<summary>urfave/cli</summary>

### [`v2.24.3`](https://togithub.com/urfave/cli/releases/tag/v2.24.3)

[Compare
Source](https://togithub.com/urfave/cli/compare/v2.24.2...v2.24.3)

#### What's Changed

- Make trim space optional by
[@&#8203;palsivertsen](https://togithub.com/palsivertsen) in
[urfave/cli#1675

**Full Changelog**:
urfave/cli@v2.24.2...v2.24.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/kairos-io/provider-kairos).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMTkuNSIsInVwZGF0ZWRJblZlciI6IjM0LjExOS41In0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

None yet

3 participants