├── Templates ├── Op Script.tmTemplate │ ├── op.slax │ └── info.plist ├── Commit Script.tmTemplate │ ├── info.plist │ └── cs.slax └── Event Script.tmTemplate │ ├── info.plist │ └── event.slax ├── Snippets ├── Variable.tmSnippet ├── Parameter.tmSnippet ├── Invoke.tmSnippet ├── Regex.tmSnippet ├── Tag - Singleton.tmSnippet ├── Else Condition.tmSnippet ├── If Contition.tmSnippet ├── Template.tmSnippet ├── For-each Loop.tmSnippet ├── Else If Condition.tmSnippet └── Tag - Result Tree Fragment.tmSnippet ├── info.plist ├── Preferences └── Folding.tmPreferences ├── README.mdown └── Syntaxes └── SLAX.tmLanguage /Templates/Op Script.tmTemplate/op.slax: -------------------------------------------------------------------------------- 1 | version 1.0; 2 | 3 | /* 4 | * Created by ${TM_FULLNAME} 5 | * Current script version is: 6 | * $Id$ 7 | * 8 | */ 9 | 10 | ns junos = "http://xml.juniper.net/junos/*/junos"; 11 | ns xnm = "http://xml.juniper.net/xnm/1.1/xnm"; 12 | ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0"; 13 | ns ext = "http://xmlsoft.org/XSLT/namespace"; 14 | 15 | import "../import/junos.xsl"; 16 | 17 | match / { 18 | { 19 | /* add stuff here */ 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /Snippets/Variable.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | var \$$1 = $2 7 | $0 8 | name 9 | Variable 10 | scope 11 | source.slax 12 | tabTrigger 13 | var 14 | uuid 15 | 7F772D68-6B88-4C14-A63C-DF5E8E6488BF 16 | 17 | 18 | -------------------------------------------------------------------------------- /Snippets/Parameter.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | param \$$1 = $2 7 | $0 8 | name 9 | Parameter 10 | scope 11 | source.slax 12 | tabTrigger 13 | param 14 | uuid 15 | 72EC714D-AB7F-4698-B05D-8ED098B9F321 16 | 17 | 18 | -------------------------------------------------------------------------------- /Snippets/Invoke.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | var \$$1 = jcs:invoke($2); 7 | $0 8 | name 9 | Invoke 10 | scope 11 | source.slax 12 | tabTrigger 13 | invoke 14 | uuid 15 | 1FE34FC6-86F3-4620-BF25-1F4A10A4C444 16 | 17 | 18 | -------------------------------------------------------------------------------- /Snippets/Regex.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | var \$$1 = jcs:regex("$2", \$$3); 7 | 8 | name 9 | Regex 10 | scope 11 | source.slax 12 | tabTrigger 13 | re 14 | uuid 15 | E9A7DC4D-DB97-4649-8357-C5536FB82407 16 | 17 | 18 | -------------------------------------------------------------------------------- /Snippets/Tag - Singleton.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | <$1> $2; 7 | $0 8 | name 9 | Tag - Singleton 10 | scope 11 | source.slax 12 | tabTrigger 13 | > 14 | uuid 15 | 8FB7ABAE-4649-4599-A165-7212C2AA5EE0 16 | 17 | 18 | -------------------------------------------------------------------------------- /Snippets/Else Condition.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | else { 7 | ${0:/* code */} 8 | } 9 | name 10 | Else Condition 11 | scope 12 | keyword.control.slax 13 | tabTrigger 14 | else 15 | uuid 16 | E60B0009-A43C-4DC0-836B-0578B485B85A 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/If Contition.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | if (${1:/* condition */}) { 7 | ${0:/* code */} 8 | } 9 | name 10 | If Contition 11 | scope 12 | keyword.control.slax 13 | tabTrigger 14 | if 15 | uuid 16 | 32C66280-4656-4798-94C6-03AA8256C676 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Template.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | template ${1:/* name */}(${2:/* args */}) { 7 | ${0:/* code */} 8 | } 9 | name 10 | Template 11 | scope 12 | source.slax 13 | tabTrigger 14 | temp 15 | uuid 16 | 45AB2C4B-B4EB-4DC3-AF1B-1626DD8D6F17 17 | 18 | 19 | -------------------------------------------------------------------------------- /info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | contactEmailRot13 6 | qtrguvatf@whavcre.arg 7 | contactName 8 | David Gethings 9 | description 10 | An API for certain Juniper Networks routing platforms. 11 | name 12 | Junoscript 13 | uuid 14 | 53F2EBB2-95B3-449D-BE1C-BD6381048670 15 | 16 | 17 | -------------------------------------------------------------------------------- /Preferences/Folding.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Folding 7 | scope 8 | source.slax 9 | settings 10 | 11 | foldingStartMarker 12 | \{ 13 | foldingStopMarker 14 | \} 15 | 16 | uuid 17 | 90B1BC97-3C5F-4DA3-A384-7BDC13AD60AA 18 | 19 | 20 | -------------------------------------------------------------------------------- /Snippets/For-each Loop.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | for-each (${1:/* iterative */}) { 7 | ${0:/* code */} 8 | } 9 | name 10 | For-each Loop 11 | scope 12 | keyword.control.slax 13 | tabTrigger 14 | for 15 | uuid 16 | B0CF5677-79AE-426D-A44F-0FEB62579361 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Else If Condition.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | else if (${1:/* condition */}) { 7 | ${0:/* code */} 8 | } 9 | name 10 | Else If Condition 11 | scope 12 | keyword.control.slax 13 | tabTrigger 14 | eif 15 | uuid 16 | FF3592D3-6835-4989-A58F-38014732C5F2 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Tag - Result Tree Fragment.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | <$1> { 7 | <$2> $3; 8 | } 9 | $0 10 | name 11 | Tag - Result Tree Fragment 12 | scope 13 | source.slax 14 | tabTrigger 15 | < 16 | uuid 17 | 4C12824E-8C2E-45C1-9F8D-EB694F37673B 18 | 19 | 20 | -------------------------------------------------------------------------------- /Templates/Op Script.tmTemplate/info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | command 6 | if [[ ! -f "$TM_NEW_FILE" ]]; then 7 | perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' \ 8 | < op.slax > "$TM_NEW_FILE" 9 | fi 10 | extension 11 | slax 12 | name 13 | Op Script 14 | uuid 15 | 2E51B478-9667-4026-8634-0F6915D7BEDB 16 | 17 | 18 | -------------------------------------------------------------------------------- /Templates/Commit Script.tmTemplate/info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | command 6 | if [[ ! -f "$TM_NEW_FILE" ]]; then 7 | perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' \ 8 | < cs.slax > "$TM_NEW_FILE" 9 | fi 10 | extension 11 | slax 12 | name 13 | Commit Script 14 | uuid 15 | A3C3D75F-32A5-45F3-BB5A-018054A4CB71 16 | 17 | 18 | -------------------------------------------------------------------------------- /Templates/Event Script.tmTemplate/info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | command 6 | if [[ ! -f "$TM_NEW_FILE" ]]; then 7 | perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' \ 8 | < event.slax > "$TM_NEW_FILE" 9 | fi 10 | extension 11 | slax 12 | name 13 | Event Script 14 | uuid 15 | 2C8E75CC-1ECB-41FB-AE0C-A7EA46557545 16 | 17 | 18 | -------------------------------------------------------------------------------- /Templates/Event Script.tmTemplate/event.slax: -------------------------------------------------------------------------------- 1 | version 1.0; 2 | 3 | /* 4 | * Created by ${TM_FULLNAME} 5 | * Current script version is: 6 | * $Id$ 7 | * 8 | */ 9 | 10 | ns junos = "http://xml.juniper.net/junos/*/junos"; 11 | ns xnm = "http://xml.juniper.net/xnm/1.1/xnm"; 12 | ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0"; 13 | ns ext = "http://xmlsoft.org/XSLT/namespace"; 14 | 15 | import "../import/junos.xsl"; 16 | 17 | match / { 18 | { 19 | 20 | var $re_status = { 21 | call is_master(); 22 | } 23 | 24 | if ($re_status == "master") { 25 | /* add stuff here */ 26 | } 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /Templates/Commit Script.tmTemplate/cs.slax: -------------------------------------------------------------------------------- 1 | version 1.0; 2 | 3 | /* 4 | * Created by ${TM_FULLNAME} 5 | * Current script version is: 6 | * $Id$ 7 | */ 8 | 9 | ns junos = "http://xml.juniper.net/junos/*/junos"; 10 | ns xnm = "http://xml.juniper.net/xnm/1.1/xnm"; 11 | ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0"; 12 | ns ext = "http://xmlsoft.org/XSLT/namespace"; 13 | 14 | import "../import/junos.xsl"; 15 | 16 | match configuration { 17 | 18 | var $re_status = { 19 | call is_master(); 20 | } 21 | 22 | if ($re_status == "master") { 23 | /* add stuff here */ 24 | } 25 | } 26 | 27 | template is_master() { 28 | var $command = "get-route-engine-information"; 29 | var $re = jcs:invoke($command); 30 | 31 | /* 32 | * if there is only one RE then is has to be master 33 | */ 34 | if (count($re/route-engine) == 1) { 35 | "master"; 36 | } 37 | /* if there is more than one RE this XPath statement is only true on the master RE */ 38 | else if ($re/route-engine[mastership-state == "master"]/load-average-one) { 39 | "master"; 40 | } 41 | else { 42 | "backup"; 43 | } 44 | } -------------------------------------------------------------------------------- /README.mdown: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | You can install this bundle in TextMate by opening the preferences and going to the bundles tab. After installation it will be automatically updated for you. 4 | 5 | # General 6 | 7 | * [Bundle Styleguide](http://kb.textmate.org/bundle_styleguide) — _before you make changes_ 8 | * [Commit Styleguide](http://kb.textmate.org/commit_styleguide) — _before you send a pull request_ 9 | * [Writing Bug Reports](http://kb.textmate.org/writing_bug_reports) — _before you report an issue_ 10 | 11 | # License 12 | 13 | If not otherwise specified (see below), files in this repository fall under the following license: 14 | 15 | Permission to copy, use, modify, sell and distribute this 16 | software is granted. This software is provided "as is" without 17 | express or implied warranty, and with no claim as to its 18 | suitability for any purpose. 19 | 20 | An exception is made for files in readable text which contain their own license information, or files where an accompanying file exists (in the same directory) with a “-license” suffix added to the base-name name of the original file, and an extension of txt, html, or similar. For example “tidy” is accompanied by “tidy-license.txt”. -------------------------------------------------------------------------------- /Syntaxes/SLAX.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | slax 8 | 9 | keyEquivalent 10 | ^~S 11 | name 12 | SLAX 13 | patterns 14 | 15 | 16 | begin 17 | /\* 18 | captures 19 | 20 | 0 21 | 22 | name 23 | punctuation.definition.comment.slax 24 | 25 | 26 | end 27 | \*/ 28 | name 29 | comment.block.slax 30 | 31 | 32 | match 33 | (\/[-a-zA-Z0-9_]+|[-a-zA-Z0-9_]+\/[-a-zA-Z0-9_]+|\/[-a-zA-Z0-9_]+\/[-a-zA-Z0-9_]+) 34 | name 35 | constant.other.namespace.slax 36 | 37 | 38 | match 39 | \b(apply-templates|call|else|for-each|if|match|mode|param|priority|template|var|version|with)\b 40 | name 41 | keyword.control.slax 42 | 43 | 44 | captures 45 | 46 | 1 47 | 48 | name 49 | storage.type.sub.slax 50 | 51 | 2 52 | 53 | name 54 | entity.name.function.slax 55 | 56 | 3 57 | 58 | name 59 | storage.type.method.slax 60 | 61 | 62 | match 63 | ^\s*(call)\s+([-a-zA-Z0-9_:]+)\s*(\([\$\@\*;]*\))? 64 | name 65 | meta.call.slax 66 | 67 | 68 | captures 69 | 70 | 1 71 | 72 | name 73 | entity.name.function.slax 74 | 75 | 2 76 | 77 | name 78 | storage.type.method.slax 79 | 80 | 81 | match 82 | ^([-a-zA-Z0-9_]+)\s*(\([\$;]*\))? 83 | name 84 | meta.method.slax 85 | 86 | 87 | begin 88 | (<)([a-zA-Z0-9:]+) 89 | end 90 | (>) 91 | name 92 | meta.tag.slax 93 | 94 | 95 | begin 96 | " 97 | beginCaptures 98 | 99 | 0 100 | 101 | name 102 | punctuation.definition.string.begin.slax 103 | 104 | 105 | end 106 | " 107 | endCaptures 108 | 109 | 0 110 | 111 | name 112 | punctuation.definition.string.end.slax 113 | 114 | 115 | name 116 | string.quoted.double.slax 117 | patterns 118 | 119 | 120 | match 121 | \\. 122 | name 123 | constant.character.escape.slax 124 | 125 | 126 | 127 | 128 | begin 129 | ' 130 | beginCaptures 131 | 132 | 0 133 | 134 | name 135 | punctuation.definition.string.begin.slax 136 | 137 | 138 | end 139 | ' 140 | endCaptures 141 | 142 | 0 143 | 144 | name 145 | punctuation.definition.string.end.slax 146 | 147 | 148 | name 149 | string.quoted.single.slax 150 | patterns 151 | 152 | 153 | match 154 | \\. 155 | name 156 | constant.character.escape.slax 157 | 158 | 159 | 160 | 161 | match 162 | \b(copy-of|expr|import|not|ns junos|ns xnm|ns jcs)\b 163 | name 164 | support.function.slax 165 | 166 | 167 | captures 168 | 169 | 1 170 | 171 | name 172 | punctuation.definition.variable.slax 173 | 174 | 175 | match 176 | (\$)([-a-zA-Z0-9_\$])*\b 177 | name 178 | variable.other.readwrite.global.slax 179 | 180 | 181 | scopeName 182 | source.slax 183 | uuid 184 | AAD4AAB9-384A-4DB4-A301-22E1D3747328 185 | 186 | 187 | --------------------------------------------------------------------------------