Skip to content

Commit

Permalink
Loading user commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubujka committed Dec 17, 2011
1 parent 81ccc09 commit d088f7a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ default_dir: ~/gtd/unsorted

Команды описываются в файле commands.rb
Кнопки описываются в rc.yaml

------------------------------------
Свои команды можно записывать в файл ~/.bu_commands.rb
3 changes: 3 additions & 0 deletions cards
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ require "lib/bind.rb"

require "commands.rb"

user_commands_file = File.expand_path "~/.bu_commands.rb"
require user_commands_file if File.exist? user_commands_file

require "rubygems"
require "backports"
require "natural_sort_kernel"
Expand Down
7 changes: 7 additions & 0 deletions cards_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,10 @@ def goto_file_mode file
default_file_action file
do_what_i_say_in_file file
end

def goto_dir_mode dir
clear
show_current_dir_line dir
default_dir_action dir
do_what_i_say_in_dir dir
end
8 changes: 0 additions & 8 deletions commands.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@

dir_cmd :goto_dir_mode do |dir|
clear
show_current_dir_line dir
default_dir_action dir
do_what_i_say_in_dir dir
end

dir_cmd :go_upper_dir do |dir|
goto_dir_mode ex_pth(fjoin(dir, '..'))
end
Expand Down

0 comments on commit d088f7a

Please sign in to comment.