Class: Makit::Cli::WorkProjectCommand

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/makit/cli/project_commands.rb

Overview

Open project in IDE or navigate to directory

Instance Method Summary collapse

Instance Method Details

#executeObject



785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
# File 'lib/makit/cli/project_commands.rb', line 785

def execute
  if list_editors?
    show_available_editors
    return
  end

  project_path = File.expand_path(path)

  unless Dir.exist?(project_path)
    puts "Error: Directory does not exist: #{project_path}"
    exit 1
  end

  editor_cmd = determine_editor

  if editor_cmd
    puts "Opening project in #{editor_cmd}..."
    launch_editor(editor_cmd, project_path)
  else
    puts "No suitable editor found. Available editors:"
    show_available_editors
    puts "\nNavigating to project directory: #{project_path}"
    puts "Run: cd #{project_path}"
  end
end