输出到文件(或stdout)的子命令的抽象基类。
FileOutputSubcommand
抽象子命令,将应用程序输出为某种类型的文件。
after_write_file
file_contents
子类必须重写此方法以返回给定文档的输出文件的内容。子类方法返回不同的类型:str:html,json bytes:SVG,png
NotImplementedError --
filename_from_route
files_arg
返回的位置参数 files 指定命令的文件输入。
files
子类应该在它们的类中包含这个 args .
args
示例
class Foo(FileOutputSubcommand): args = ( FileOutputSubcommand.files_arg("FOO"), # more args for Foo ) + FileOutputSubcommand.other_args()
invoke
other_args
返回的参数 -o / --output 指定输出应写入的位置,对于 --args 将任何其他命令行参数传递给子命令。
-o
--output
--args
子类应该将这些附加到它们的类中 args .
write_file