添加后缀支持
This commit is contained in:
@@ -5,6 +5,7 @@ import { path } from "tiny/path";
|
|||||||
export interface ExporterConfigs {
|
export interface ExporterConfigs {
|
||||||
enabled: boolean,
|
enabled: boolean,
|
||||||
directory: string,
|
directory: string,
|
||||||
|
extension?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TableExporter {
|
export class TableExporter {
|
||||||
@@ -15,7 +16,7 @@ export class TableExporter {
|
|||||||
this.configs = configs;
|
this.configs = configs;
|
||||||
}
|
}
|
||||||
|
|
||||||
get extension(): string { return ''}
|
get extension(): string { return this.configs.extension || ''; }
|
||||||
|
|
||||||
protected line(text = "", indent = 0) {
|
protected line(text = "", indent = 0) {
|
||||||
return this.indent_text(text, indent) + '\n';
|
return this.indent_text(text, indent) + '\n';
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export class JSONExporter extends TableExporter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get extension(): string { return 'json'}
|
get extension(): string { return this.configs.extension || 'json'; }
|
||||||
|
|
||||||
protected recursively_order_keys(unordered: object | Array<object>) {
|
protected recursively_order_keys(unordered: object | Array<object>) {
|
||||||
// If it's an array - recursively order any
|
// If it's an array - recursively order any
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ interface YAMLExporterConfigs extends ExporterConfigs {
|
|||||||
|
|
||||||
export class YAMLExporter extends JSONExporter {
|
export class YAMLExporter extends JSONExporter {
|
||||||
|
|
||||||
get extension(): string { return 'yaml'}
|
get extension(): string { return this.configs.extension || 'yaml'; }
|
||||||
|
|
||||||
constructor(configs: ExporterConfigs) {
|
constructor(configs: ExporterConfigs) {
|
||||||
super(configs);
|
super(configs);
|
||||||
|
|||||||
Reference in New Issue
Block a user