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

the behavior of --value is non-obvious #29

Closed
masukomi opened this issue Jul 29, 2022 · 6 comments
Closed

the behavior of --value is non-obvious #29

masukomi opened this issue Jul 29, 2022 · 6 comments

Comments

@masukomi
Copy link

masukomi commented Jul 29, 2022

[edit] this was a ticket proposing the addition of a --default option. It turns out that that was user error / ignorance on my part BUT the documentation should still be improved to make it clear what --value does and how it behaves. (see comment below)

@masukomi
Copy link
Author

masukomi commented Jul 29, 2022

[redacted after discovering --value (see below)]

@masukomi
Copy link
Author

masukomi commented Jul 29, 2022

Turns out this is actually a documentation problem, not a code problem

--value serves this function and the visual choice was

> default

Suggested changes:

the help docs say

      --value=""                           Initial value (can also be passed via stdin)

they fail to note 3 important things:

  1. --value supersedes --placeholder and any placeholder will not be displayed
  2. unlike placeholder the value will be editable
  3. unlike placeholder the value will be returned if the user just hits enter.

the tutorial needs to be modified because this example will never work as intended. The --placeholder is never going to be displayed.

SUMMARY=$(gum input --value "$TYPE$SCOPE: " --placeholder "Summary of this change")

Maybe this is indicative of past behavior that somehow got lost?

I still think --default would be a better name for this because it's more self-evident what to expect from it. Maybe we could deprecate ( support but stop mentioning ) value and replace it with --default as well as the suggested documentation?

@masukomi masukomi changed the title gum input should have a --default option the behavior of --value is non-obvious Jul 29, 2022
@polm
Copy link

polm commented Aug 2, 2022

These value names and their behavior (like how placeholder is ignored if value is set) are the same as the HTML <input> element.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#placeholder

@maaslalani
Copy link
Contributor

@polm This is a great point:

The --value and --placeholder flags behave the same as their counter parts in HTML which I think is beneficial. We might revisit this naming but I this @polm has a great point that these match HTML and I think it makes sense to keep them like this for the time being unless there is a much stronger argument to deviate.

@maaslalani maaslalani closed this as not planned Won't fix, can't repro, duplicate, stale Aug 3, 2022
@masukomi
Copy link
Author

i believe this ticket has been closed prematurely:

even if you don't change anything about the naming or behavior , there's still the outstanding problems noted above of missing documentation and the example that can't possibly work.

@maaslalani
Copy link
Contributor

i believe this ticket has been closed prematurely:

even if you don't change anything about the naming or behavior , there's still the outstanding problems noted above of missing documentation and the example that can't possibly work.

We can definitely document this behaviour 👍

The example works correctly, the placeholder value will show up if the value (that is pre-filled) is deleted by the user, as shown in the example.

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

No branches or pull requests

3 participants