Добавление чтения списка pre и post команд при выполнении snag
This commit is contained in:
parent
9f8759238b
commit
5f746c33b7
2 changed files with 23 additions and 4 deletions
|
@ -4,12 +4,11 @@
|
|||
"email": "user@site.domain",
|
||||
"author": "snag",
|
||||
"presnag": [
|
||||
"/usr/bin/ls",
|
||||
"/usr/local/bin/script.sh"
|
||||
"echo $(which ls)",
|
||||
"pwd"
|
||||
],
|
||||
"postsnag": [
|
||||
"/usr/bin/ls",
|
||||
"/usr/local/bin/script.sh"
|
||||
"/usr/bin/ls"
|
||||
],
|
||||
"rules": {
|
||||
"tracking": [
|
||||
|
|
|
@ -17,6 +17,8 @@ class SnagConfig {
|
|||
private string _author;
|
||||
private string[] _tracking;
|
||||
private string[] _ignore;
|
||||
private string[] _presnag;
|
||||
private string[] _postsnag;
|
||||
|
||||
this(string configFile) {
|
||||
string jsonText;
|
||||
|
@ -119,6 +121,22 @@ class SnagConfig {
|
|||
_ignore = rules["ignore"].array.map!(item => item.str).array;
|
||||
}
|
||||
}
|
||||
|
||||
if ("presnag" in jsonData) {
|
||||
if (jsonData["presnag"].type != JSONType.array)
|
||||
throw new SnagConfigException(
|
||||
"The \"presnag\" parameter must be an array containing a set of commands"
|
||||
);
|
||||
_presnag = jsonData["presnag"].array.map!(item => item.str).array;
|
||||
}
|
||||
|
||||
if ("postsnag" in jsonData) {
|
||||
if (jsonData["postsnag"].type != JSONType.array)
|
||||
throw new SnagConfigException(
|
||||
"The \"postsnag\" parameter must be an array containing a set of commands"
|
||||
);
|
||||
_postsnag = jsonData["postsnag"].array.map!(item => item.str).array;
|
||||
}
|
||||
}
|
||||
|
||||
@property string git() const { return _git; }
|
||||
|
@ -127,4 +145,6 @@ class SnagConfig {
|
|||
@property string author() const { return _author; }
|
||||
@property const(string[]) tracking() const { return _tracking; }
|
||||
@property const(string[]) ignore() const { return _ignore; }
|
||||
@property const(string[]) presnag() const { return _presnag; }
|
||||
@property const(string[]) postsnag() const { return _postsnag; }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue