bilderhic
Advanced tools
Comparing version 1.0.29 to 1.0.30
{ | ||
"name": "bilderhic", | ||
"version": "1.0.29", | ||
"version": "1.0.30", | ||
"description": "Bilderhic (bhic) is a smart and simple command tool for automatization.", | ||
@@ -5,0 +5,0 @@ "preferGlobal": true, |
@@ -54,2 +54,4 @@ # bilderhic | ||
```bash | ||
env load File.yml | ||
:open config.xml | ||
@@ -56,0 +58,0 @@ - set widget.id=[app.id] |
@@ -46,3 +46,8 @@ const fs = require('fs'); | ||
if (cmd === "close") { | ||
if (cmd === "configure") { | ||
let selector = line.substr(0, line.indexOf("=")).trim(); | ||
let value = this.environment.applyVariables(line.substr(line.indexOf("=") + 1)); | ||
editor.configure(selector, value); | ||
} | ||
else if (cmd === "close") { | ||
editor.close(); | ||
@@ -49,0 +54,0 @@ } |
class BaseEditor { | ||
constructor() { | ||
this._options = {}; | ||
} | ||
get formats() { | ||
@@ -10,2 +14,10 @@ throw new Error("Not implemented"); | ||
get options() { | ||
return this._options; | ||
} | ||
set options(value) { | ||
this._options = value; | ||
} | ||
open(name) { | ||
@@ -26,2 +38,6 @@ throw new Error("Not implemented"); | ||
configure(key, value) { | ||
this.options[key] = value; | ||
} | ||
close() { | ||
@@ -28,0 +44,0 @@ throw new Error("Not implemented"); |
@@ -6,4 +6,5 @@ const BaseEditor = require("./base/base-editor"); | ||
const options = { | ||
ignoreAttributes: false | ||
const defaultOptions = { | ||
ignoreAttributes: false, | ||
format: true | ||
}; | ||
@@ -17,2 +18,3 @@ | ||
this.file = null; | ||
this.options = defaultOptions; | ||
} | ||
@@ -42,3 +44,3 @@ | ||
else { | ||
this.object = parser.parse(content, options); | ||
this.object = parser.parse(content, this.options); | ||
} | ||
@@ -54,3 +56,3 @@ } | ||
else { | ||
this.object = parser.parse(content, options); | ||
this.object = parser.parse(content, this.options); | ||
} | ||
@@ -95,2 +97,10 @@ } | ||
configure(key, value) { | ||
if (key === "format") { | ||
value = value == "true"; | ||
} | ||
super.configure(key, value); | ||
} | ||
set(selector, value) { | ||
@@ -123,3 +133,3 @@ let current = this.object; | ||
serialize() { | ||
const jsonParser = new JsonToXmlParser(options); | ||
const jsonParser = new JsonToXmlParser(this.options); | ||
let finalContent = this.declaration + jsonParser.parse(this.object); | ||
@@ -126,0 +136,0 @@ return finalContent; |
@@ -12,2 +12,3 @@ const XmlEditor = require("../src/file-editors/xml.editor"); | ||
editor = new XmlEditor(); | ||
editor.options.format = false; | ||
}); | ||
@@ -14,0 +15,0 @@ |
@@ -7,3 +7,3 @@ env set counter 0 | ||
echo 3) [$currentFileAbsolutePath] | ||
:iifEq [$p.counter] == [$filesCount] | ||
:if [$p.counter] == [$filesCount] | ||
echo Total Files [$p.counter] |
49803
1239
159