Class: LLM::Shell::Command::DirImport
- Inherits:
-
Object
- Object
- LLM::Shell::Command::DirImport
- Includes:
- Utils
- Defined in:
- lib/llm/shell/commands/dir_import.rb
Class Method Summary collapse
-
.complete(path) ⇒ Array<String>
Completes a path with a wildcard.
Instance Method Summary collapse
-
#initialize(context) ⇒ LLM::Shell::Command::DirImport
constructor
-
#call(dir) ⇒ void
Recursively imports all files in a directory.
Constructor Details
#initialize(context) ⇒ LLM::Shell::Command::DirImport
22 23 24 |
# File 'lib/llm/shell/commands/dir_import.rb', line 22 def initialize(context) @context = context end |
Class Method Details
.complete(path) ⇒ Array<String>
Completes a path with a wildcard.
14 15 16 |
# File 'lib/llm/shell/commands/dir_import.rb', line 14 def self.complete(path) Dir["#{path}*"] end |
Instance Method Details
#call(dir) ⇒ void
This method returns an undefined value.
Recursively imports all files in a directory.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/llm/shell/commands/dir_import.rb', line 29 def call(dir) Dir.entries(dir).each do |file| if file == "." || file == ".." next elsif File.directory? File.join(dir, file) call File.join(dir, file) else import File.join(dir, file) end end end |