Support custom type coertion
まだ誰も着手していません。
評価
調査の方向性
Read the current type-coercion branch and Ruby's OptionParser#accept API first, then trace how parser definitions are registered and applied. Done means callers can register a custom User coercion alongside built-in types, parse the example input into a User, and retain existing required and pattern behavior.
索引モデルが issue の本文から書いたものです。
説明
Instead of an if/elsif/else expression, we can store accepted types in a hash and a proc that uses it to convert. That way, users can register custom type coercion strategies.
I'm thinking something like:
parser = ArgumentParser.build do
accept User do |string|
User.find(string)
end
required :action, pattern: [:delete, :update]
required :user, type: User
end
args = parser.parse!(["user-1"])
# => { user: #<User id="user-1"> }
We can copy OptionParser's API for that.
- 主要言語
- Ruby
- スター
- 3
- フォーク
- 0
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
thoughtbot/argument_parser のほかの issue
-
good first issue
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
thoughtbot/argument_parser の issue をすべて見る
似ている issue
-
user-reported
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
Kong/developer.konghq.com#7316 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
TheOdinProject/curriculum#31408 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
notch8/utk_knapsack#148 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
Homebrew/homebrew-cask#288729 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100