omniai-tools 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/omniai/tools/disk_tool.rb +18 -4
- data/lib/omniai/tools/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cc5add2c5d444b00147bf86ef80aab2680259169056e0d95dd7be2774e0288e
|
4
|
+
data.tar.gz: df22289d9b5d7ac3b4ec931e81adfecba9321f940872ebab0c14db15afc2b94a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 014db86e451df68380745099a5137811f7e7775491130835ded603a9fc2c66a56a9b77632347e152bc9c8b260db4f3124979f35f3a43b951f9f6b7c4bd8643d2
|
7
|
+
data.tar.gz: 6285ac35f23218d82c8b883d4f4660e730a0555e27b523b08acfea67c6f59987926f0afe4b977901ec4142c4243157ac512712df7782fd42564987d3da6582b1
|
@@ -63,12 +63,24 @@ module OmniAI
|
|
63
63
|
* `#{Action::FILE_REPLACE}`
|
64
64
|
TEXT
|
65
65
|
|
66
|
-
|
66
|
+
parameter :to, :string, description: <<~TEXT
|
67
67
|
A file or directory path that is required for the following actions:
|
68
68
|
* `#{Action::DIRECTORY_MOVE}`
|
69
69
|
* `#{Action::FILE_MOVE}`
|
70
70
|
TEXT
|
71
71
|
|
72
|
+
parameter :text, :string, description: <<~TEXT
|
73
|
+
The text to be written to a file for the `#{Action::FILE_WRITE}` action.
|
74
|
+
TEXT
|
75
|
+
|
76
|
+
parameter :old_text, :string, description: <<~TEXT
|
77
|
+
The old text to be replaced in a file for the `#{Action::FILE_REPLACE}` action.
|
78
|
+
TEXT
|
79
|
+
|
80
|
+
parameter :new_text, :string, description: <<~TEXT
|
81
|
+
The new text to replace in a few file for the `#{Action::FILE_REPLACE}` action.
|
82
|
+
TEXT
|
83
|
+
|
72
84
|
# @param driver [Computer::Driver]
|
73
85
|
def initialize(logger: Logger.new(IO::NULL))
|
74
86
|
@logger = logger
|
@@ -78,7 +90,9 @@ module OmniAI
|
|
78
90
|
# @param action [String]
|
79
91
|
# @param path [String]
|
80
92
|
# @param to [String]
|
81
|
-
|
93
|
+
# @param old_text [String]
|
94
|
+
# @param new_text [String]
|
95
|
+
def execute(action:, path: nil, to: nil, old_text: nil, new_text: nil)
|
82
96
|
@logger.info({
|
83
97
|
action:,
|
84
98
|
path:,
|
@@ -94,8 +108,8 @@ module OmniAI
|
|
94
108
|
when Action::FILE_DELETE then Disk::FileDeleteTool.new(logger: @logger).execute(path:)
|
95
109
|
when Action::FILE_MOVE then Disk::FileMoveTool.new(logger: @logger).execute(path:, to:)
|
96
110
|
when Action::FILE_READ then Disk::FileReadTool.new(logger: @logger).execute(path:)
|
97
|
-
when Action::FILE_WRITE then Disk::FileWriteTool.new(logger: @logger).execute(path:)
|
98
|
-
when Action::FILE_REPLACE then Disk::FileReplaceTool.new(logger: @logger).execute(path:)
|
111
|
+
when Action::FILE_WRITE then Disk::FileWriteTool.new(logger: @logger).execute(path:, text:)
|
112
|
+
when Action::FILE_REPLACE then Disk::FileReplaceTool.new(logger: @logger).execute(old_text:, new_text:, path:)
|
99
113
|
end
|
100
114
|
end
|
101
115
|
end
|
data/lib/omniai/tools/version.rb
CHANGED