Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jules2689 authored Dec 9, 2017
1 parent 5dd45cf commit 5145bbc
Showing 1 changed file with 73 additions and 12 deletions.
85 changes: 73 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,81 @@ Dev UI is a small framework who's only responsibility is to print pretty to the

This may not be an exhaustive list. Please check our [documentation](http://www.rubydoc.info/github/Shopify/dev-ui/master/Dev/UI) for more information.

- Nested framing to handle content flow (see example below)
![Nested Framing](https://user-images.githubusercontent.com/3074765/33799861-cb5dcb5c-dd01-11e7-977e-6fad38cee08c.png)
- Interactive Prompts (prompt user with options, using arrow keys, numbers, or vim bindings, choose)
![Interactive Prompt](https://user-images.githubusercontent.com/3074765/33797984-0ebb5e64-dcdf-11e7-9e7e-7204f279cece.gif)
- Free form text prompts
### Nested framing
To handle content flow (see example below)

```ruby
Dev::UI::StdoutRouter.enable
Dev::UI::Frame.open('Frame 1') do
Dev::UI::Frame.open('Frame 2') { puts "inside frame 2" }
puts "inside frame 1"
end
```

![Nested Framing](https://user-images.githubusercontent.com/3074765/33799861-cb5dcb5c-dd01-11e7-977e-6fad38cee08c.png)

### Interactive Prompts
Prompt user with options and ask them to choose. Can answer using arrow keys, numbers, or vim bindings (or y/n for yes/no questions)

```ruby
Dev::UI.ask('What language/framework do you use?', options: %w(rails go ruby python))
Dev::UI::InteractivePrompt.call(%w(rails go ruby python))
```

![Interactive Prompt](https://user-images.githubusercontent.com/3074765/33797984-0ebb5e64-dcdf-11e7-9e7e-7204f279cece.gif)

### Free form text prompts

```ruby
Dev::UI.ask('Is Dev UI Awesome?', default: 'It is great!')
```

![Free form text prompt](https://user-images.githubusercontent.com/3074765/33799822-47f23302-dd01-11e7-82f3-9072a5a5f611.png)
- Spinner groups to handle many multi-threaded processes (see example below)
![Spinner Group](https://user-images.githubusercontent.com/3074765/33798295-d94fd822-dce3-11e7-819b-43e5502d490e.gif)
- Text Color formatting (e.g. `{{red:Red}} {{green:Green}}`)

### Spinner groups
Handle many multi-threaded processes while suppressing output unless there is an issue. Can update title to show state.


```ruby
spin_group = Dev::UI::SpinGroup.new
spin_group.add('Title') { |spinner| sleep 3.0 }
spin_group.add('Title 2') { |spinner| sleep 3.0; spinner.update_title('New Title'); sleep 3.0 }
spin_group.wait
```

![Spinner Group](https://user-images.githubusercontent.com/3074765/33798295-d94fd822-dce3-11e7-819b-43e5502d490e.gif)

### Text Color formatting
e.g. `{{red:Red}} {{green:Green}}`

```ruby
puts Dev::UI.fmt "{{red:Red}} {{green:Green}}"
```

![Text Format](https://user-images.githubusercontent.com/3074765/33799827-6d0721a2-dd01-11e7-9ab5-c3d455264afe.png)
- Symbol/Glyph Formatting (e.g. `{{*}}` => a yellow ⭑)
![Symbol Formatting](https://user-images.githubusercontent.com/3074765/33799847-9ec03fd0-dd01-11e7-93f7-5f5cc540e61e.png)
- Progress Bar
![Progress Bar](https://user-images.githubusercontent.com/3074765/33799794-cc4c940e-dd00-11e7-9bdc-90f77ec9167c.gif)

### Symbol/Glyph Formatting
e.g. `{{*}}` => a yellow ⭑

```ruby
puts Dev::UI.fmt "{{*}} {{x}} {{?}} {{v}}"
```

![Symbol Formatting](https://user-images.githubusercontent.com/3074765/33799847-9ec03fd0-dd01-11e7-93f7-5f5cc540e61e.png)

### Progress Bar

Show progress of a process or operation.

```ruby
Dev::UI::Progress.progress do |bar|
100.times do
bar.tick
end
end
```

![Progress Bar](https://user-images.githubusercontent.com/3074765/33799794-cc4c940e-dd00-11e7-9bdc-90f77ec9167c.gif)

## Installation

Expand Down

0 comments on commit 5145bbc

Please sign in to comment.