README.md in prompts-0.2.0 vs README.md in prompts-0.2.1
- old
+ new
@@ -254,9 +254,35 @@
<pre>
<b>Press Enter ⏎ to continue...</b> |
</pre>
+## Forms
+
+Often, you will have multiple prompts that will be displayed in sequence to collect information before performing additional actions. You may use the `Prompts::Form` class to create a grouped set of prompts for the user to complete:
+
+```ruby
+responses = Prompts::Form.submit do |form|
+ form.text(
+ label: "What is your name?",
+ required: true
+ )
+ form.select(
+ label: "What role should the user have?",
+ options: {
+ member: "Member",
+ contributor: "Contributor",
+ owner: "Owner",
+ }
+ )
+ form.confirm(
+ label: 'Do you accept the terms?'
+ )
+end
+```
+
+The `submit` method will return an array containing all of the responses from the form's prompts.
+
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).