required Boolean with non-default value
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start by reproducing the annotated command examples using Boolean and boolean, then inspect how @Option required, defaultValue, and help-menu optionality are processed. Compare omitted options with explicit true and false values; done means a required Boolean option has no implicit choice and the help output and command validation consistently reflect that.
索引モデルが issue の本文から書いたものです。
説明
spring shell version: 3.1.6
In one of my commands, I want to make sure that the end-user specifically indicates whether they either want A or B by using a Boolean. I don't want to make the choice for the end user.
When I add the following @Option on my command:
@Option(required = true, description = "Description", longNames = "Some long name") Boolean booleanOption
Spring Shell, automatically transforms the booleanOption to defaultValue false. The help menu of the command indicates that the booleanOption is optional.
When transforming into
@Option(required = true, description = "Description", longNames = "Some long name") boolean booleanOption
Still, the help menu indicates the booleanOption as optional. I assume for 2 reasons that this should not be the case: (1) it is a boolean and not Boolean. (2) required is explicitly set to true. The defaultValue is again false.
Setting the defaultValue to 'true' explicitly seems to be working.
@Option(required = true, description = "Description", longNames = "Some long name", defaultValue = "true")boolean booleanOption
It will show that the boolean is optional, but the default value will be true.
But again, I didn't want to choose for the user. I want the end user to articulate their choice when doing a command specifically.
If I write:
@Option(required = true, description = "Description", longNames = "Some long name", defaultValue = "")Boolean booleanOption
Or
@Option(required = true, description = "Description", longNames = "Some long name", defaultValue = "null")Boolean booleanOption
The defaultValue still translates to false (while as a Boolean I would expect it to be able to be null).
Is this the intended behavior?
- 主要言語
- Java
- スター
- 826
- フォーク
- 405
- 平均マージ
- 6日 9時間
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
spring-projects/spring-shell のほかの issue
-
NonInteractiveShellRunner, wrong exit value when Commands cannot be parsed対応中かも @czpilar が 6 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
spring-projects/spring-shell#1391 · コメント 2 件 ·
メンテナーはふだん 3 日以内に返信
-
Options validation error messages in non-interactive mode対応中かも @czpilar が 6 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
spring-projects/spring-shell#1390 · コメント 3 件 ·
メンテナーはふだん 3 日以内に返信
-
ShellInputProvider inputs are not consumed by `ComponentFlow`-based interactive components (e.g. `ConfirmationInput`, `StringInput`)対応中かも @czpilar が 18 日前に担当しました。 オープンtype/enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
spring-projects/spring-shell#1383 · コメント 6 件 ·
メンテナーはふだん 3 日以内に返信
-
area/dependencies type/enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
spring-projects/spring-shell#1213 · リアクション 2 件 ·
メンテナーはふだん 3 日以内に返信
-
Revisit dependency to Spring Messaging対応中かも @piotrooo が 292 日前に担当しました。 オープンarea/dependencies type/enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
spring-projects/spring-shell#1205 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
spring-projects/spring-shell の issue をすべて見る
似ている issue
-
BoxAttachmentMulti parsing leaks IOException / ArrayIndexOutOfBoundsException on malformed content instead of IllegalArgumentException対応中かも @Kshot3000 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
ergoplatform/ergo-appkit#272 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
utopia-rise/godot-jvm#1004 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
spring-projects/spring-grpc#442 ·