Commit Graph

5 Commits

Author SHA1 Message Date
Pat Gavlin 2bad0a85e8 [cli] Add an "open in browser" keybinding
Add support for using Ctrl+O to open the current update in the browser
for backends that support permalinks.

The keybinding is advertised in the interactive display as part of the
message that displays the permalink:

```
Previewing update (dev)

View in Browser (Ctrl+O): https://<some-url>

     Type                          Name      Plan
 +   pulumi:pulumi:Stack           vpc-dev   create
 +   ├─ aws:ec2:Vpc                vpc       create
 +   ├─ aws:ec2:SecurityGroup      secgroup  create
 +   ├─ aws:ec2:SecurityGroupRule  rule-2    create
 +   ├─ aws:ec2:SecurityGroupRule  rule-0    create
 +   ├─ aws:ec2:SecurityGroupRule  rule-1    create
 +   └─ aws:ec2:SecurityGroupRule  rule-3    create
```

In order to maintain backwards compatibility with older versions of the
Automation API, the message is not changed for non-interactive
scenarios.
2023-03-09 15:52:13 -08:00
Pat Gavlin 5c77ce69fc [cli] Add autoscrolling and support page-{down,up}
- If the display is scrolled to the bottom, autoscroll it as new lines are
  added to the output.

- Add support for scrolling the interactive display using page-down and
  page-up. These keys scroll the display N lines at a time, where N is the
  height of the terminal.
2023-03-07 12:16:02 -08:00
Pat Gavlin f92cb3d5d0 [display] Hide the cursor in interactive mode.
Hiding the cursor should eliminate the last of the redraw artifacts.
2022-12-20 10:56:59 -08:00
Pat Gavlin 4fcf040ade [display] Overwrite terminal contents
Instead of clearing the contents of the display with each frame,
overwrite its contents by clearing to the end of each line prior to a
newline. This should eliminate flickering in the interactive display.

This also eliminates a couple of off-by-one errors that were hampering
usability.
2022-12-20 10:27:31 -08:00
Pat Gavlin a20ddffde5 [cli] Abstract out terminal interactions
Replace direct interaction with the terminal with an abstraction. This
abstraction is tightly constrained to the capabilities needed for the
CLI's display. Using this abstraction allows for straightforward testing
of the interactive renderers.
2022-11-08 17:13:56 -08:00