dotfiles/conf.d/texstudio/macro/Macro_19.txsMacro
2021-03-27 17:02:43 +01:00

50 lines
1.8 KiB
Plaintext

{
"name" : "Git" ,
"tag" : [
"%SCRIPT",
"choisedialog = UniversalInputDialog([\"Commit\",\"Commit with Push\"],\"Git\",\"choiseGIT\")",
"choisedialog.setWindowTitle(\"Git\")",
"choise = choisedialog.get(\"comment\")",
"if (choisedialog.exec() != null) {",
"if (choisedialog.get(\"choiseGIT\") == \"Commit\") {",
"dialog = new UniversalInputDialog()",
"dialog.setWindowTitle(\"Git commit / push\")",
"dialog.add(\"Committed by TeXstudio\", \"Comment\", \"comment\")",
"dialog.add(true, \"Commit all Files\",\"allfiles\")",
"if (dialog.exec() != null) {",
"comment = dialog.get(\"comment\")",
"if ((dialog.get(\"allfiles\")) == true){",
"buildManager.runCommand(\"git commit -a -m \\"\" + comment + \"\\"\", editor.fileName())",
"}else{",
"buildManager.runCommand(\"git commit \" + editor.fileName() + \" -m \\"\" + comment + \"\\"\", editor.fileName())",
"}",
"}",
"} else if (choisedialog.get(\"choiseGIT\") == \"Commit with Push\") {",
"dialog = new UniversalInputDialog()",
"dialog.setWindowTitle(\"Git commit / push\")",
"dialog.add(\"Committed by TeXstudio\", \"Comment\", \"comment\")",
"dialog.add(\"master\", \"Branch\", \"branch\")",
"dialog.add(true, \"Commit all Files\",\"allfiles\")",
"if (dialog.exec() != null) {",
"comment = dialog.get(\"comment\")",
"branch = dialog.get(\"branch\")",
"if ((dialog.get(\"allfiles\")) == true){",
"buildManager.runCommand(\"git commit -a -m \\"\" + comment + \"\\"\", editor.fileName())",
"}else{",
"buildManager.runCommand(\"git commit \" + editor.fileName() + \" -m \\"\" + comment + \"\\"\", editor.fileName())",
"}",
"buildManager.runCommand(\"git push origin \\"\" + branch +\"\\"\", editor.fileName())",
"}",
"}",
"}",
""
],
"description" : [
""
],
"abbrev" : "" ,
"trigger" : "" ,
"menu" : "Scripts" ,
"shortcut" : ""
}