我正在使用Red 绑定来读取和写入文件,并且硬编码文件名版本运行良好。但我想从命令行动态获取文件名。因为Red
现在没有这样的实用程序。所以我试着用Red/System
. 我现在可以获得命令行参数,但我不知道如何将它传递给Red
部件。像下面的例子一样,我需要传递source-file
andtarget-file
到read
and write
:
Red []
#include %input-output.red
#system-global [
args: system/args-list
args: args + 1
source-file: args/item
args: args + 1
target-file: args/item
print [source-file target-file ]
]
data: read source-file
probe data
write target-file data