cli: Add support for 'firing' projects.
This commit is contained in:
parent
3b0e5a2ce3
commit
19e6e14f01
3 changed files with 23 additions and 15 deletions
|
@ -59,20 +59,8 @@ module Kook
|
|||
raise MissingProject if not @projects.has_key? project_name
|
||||
|
||||
project_path = @projects[project_name].path
|
||||
@projects[project_name].each_view do |view,view_data|
|
||||
target = ENV['KONSOLE_DBUS_SERVICE'] || 'org.kde.konsole'
|
||||
session=`qdbus #{target} /Konsole newSession`.strip
|
||||
|
||||
system "qdbus org.kde.konsole /Sessions/#{session} sendText \"cd #{project_path}\n\""
|
||||
system "qdbus org.kde.konsole /Sessions/#{session} sendText \"cd #{view_path}\n\""
|
||||
system "qdbus org.kde.konsole /Sessions/#{session} sendText \"clear\n\""
|
||||
system "qdbus org.kde.konsole /Sessions/#{session} setTitle 1 \"#{view}\""
|
||||
next unless config['commands'][project].has_key? view
|
||||
config['commands'][project][view].each do |command|
|
||||
system "qdbus org.kde.konsole /Sessions/#{session} sendText \"#{command}\""
|
||||
system "qdbus org.kde.konsole /Sessions/#{session} sendText \"\n\""
|
||||
end
|
||||
end
|
||||
@projects[project_name].fire
|
||||
|
||||
end
|
||||
|
||||
def add_view project_name, view_name, view_path=nil
|
||||
|
|
|
@ -162,8 +162,11 @@ module Kook
|
|||
subcommand "command", CLI::Command
|
||||
|
||||
desc "fire [PROJECT]", "Run project environment"
|
||||
def fire project_name=nil
|
||||
|
||||
def fire
|
||||
before_filter options
|
||||
project_name = @app.current_project
|
||||
|
||||
@app.fire_project project_name
|
||||
end
|
||||
|
||||
|
|
|
@ -31,6 +31,23 @@ module Kook
|
|||
@path = path
|
||||
end
|
||||
|
||||
def fire
|
||||
target = ENV['KONSOLE_DBUS_SERVICE'] || 'org.kde.konsole'
|
||||
|
||||
@views.each do |view,view_data|
|
||||
session=`qdbus #{target} /Konsole newSession`.strip
|
||||
system "qdbus org.kde.konsole /Sessions/#{session} sendText \"cd #{@path}\n\""
|
||||
system "qdbus org.kde.konsole /Sessions/#{session} sendText \"cd #{view_data.path}\n\""
|
||||
system "qdbus org.kde.konsole /Sessions/#{session} sendText \"clear\n\""
|
||||
system "qdbus org.kde.konsole /Sessions/#{session} setTitle 1 \"#{view}\""
|
||||
|
||||
view_data.commands.each do |command|
|
||||
system "qdbus org.kde.konsole /Sessions/#{session} sendText \"#{command}\""
|
||||
system "qdbus org.kde.konsole /Sessions/#{session} sendText \"\n\""
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def create_view view_name, view_path
|
||||
raise ExistingView, view_name if @views.has_key? view_name
|
||||
View.validate_name view_name
|
||||
|
|
Loading…
Reference in a new issue