Class: GDKBox::VSCode
- Inherits:
-
Object
- Object
- GDKBox::VSCode
- Defined in:
- lib/gdkbox/vscode.rb
Overview
Bridges a box to VS Code's Remote-SSH support.
Because each box already has a Host gdkbox-<name> entry in the generated
SSH config, opening it is just a matter of pointing the code CLI at the
matching ssh-remote+ authority.
Instance Method Summary collapse
- #available? ⇒ Boolean
-
#initialize(shell: Shell.new) ⇒ VSCode
constructor
A new instance of VSCode.
- #open(box) ⇒ Object
- #open_command(box) ⇒ Object
Constructor Details
Instance Method Details
#available? ⇒ Boolean
14 15 16 |
# File 'lib/gdkbox/vscode.rb', line 14 def available? !@shell.which("code").nil? end |
#open(box) ⇒ Object
22 23 24 |
# File 'lib/gdkbox/vscode.rb', line 22 def open(box) @shell.run!(*open_command(box)) end |
#open_command(box) ⇒ Object
18 19 20 |
# File 'lib/gdkbox/vscode.rb', line 18 def open_command(box) ["code", "--remote", "ssh-remote+#{box.ssh_host_alias}", box.remote_path] end |