Class: FindWish
- Inherits:
-
Djinni::Wish
- Object
- Djinni::Wish
- FindWish
- Defined in:
- lib/git_xplorer/wish/find_wish.rb
Instance Method Summary collapse
- #aliases ⇒ Object
- #description ⇒ Object
- #execute(args, djinni_env = Hash.new) ⇒ Object
- #usage ⇒ Object
Instance Method Details
#aliases ⇒ Object
4 5 6 |
# File 'lib/git_xplorer/wish/find_wish.rb', line 4 def aliases return ["find"] end |
#description ⇒ Object
8 9 10 |
# File 'lib/git_xplorer/wish/find_wish.rb', line 8 def description return "Similar to \"find . -iregex PATTERN\"" end |
#execute(args, djinni_env = Hash.new) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/git_xplorer/wish/find_wish.rb', line 12 def execute(args, djinni_env = Hash.new) gitx = djinni_env["gitXplorer"] args.gsub!(/^(["'])(.*)\1$/, "\\2") dir = gitx.pwd.gsub(%r{^[^/]+(/|$)}, "") begin puts gitx.get_filenames(dir, args) rescue GitXplorer::Error => e puts e. end end |
#usage ⇒ Object
24 25 26 27 |
# File 'lib/git_xplorer/wish/find_wish.rb', line 24 def usage puts "#{aliases.join(", ")} [PATTERN]" puts " #{description}." end |