@@ -17,12 +17,12 @@ module.exports = new Extension({
1717 'download' : false ,
1818 'start_command' : function ( args , tokens ) {
1919 // 1. clone template .xinitrc
20- var filePath = _cloneTemplate ( this . xinitrcTplPath ) ;
21- // 1 . parse options from args into tokens
22- var _tokens = _extendTokens ( args , tokens ) ;
23- // 1 . replace tokens in .xinitrc
20+ var filePath = _cloneTemplate ( this . xinitrcTplPath ) ,
21+ // 2 . parse options from args into tokens
22+ _tokens = _extendTokens ( args , tokens ) ;
23+ // 3 . replace tokens in .xinitrc
2424 _replaceTokens ( filePath , _tokens ) ;
25- // 2 . return xinit
25+ // 4 . return xinit
2626 return 'xinit ' + filePath ;
2727 } ,
2828 'end_command' : 'pkill -f X' ,
@@ -36,22 +36,23 @@ module.exports = new Extension({
3636 * @param {object } args Arguments provided to this extension
3737 * @param {object } tokens Original tokens for this extension
3838 */
39- function _extendTokens ( args , tokens ) {
40- var _tokens = { } ;
41- // shallow-copy the original tokens object
42- for ( var key in tokens ) {
43- _tokens [ key ] = tokens [ key ] ;
44- }
39+ function _extendTokens ( args , tokens ) {
40+ var _tokens = { } ,
41+ expectedKeys = [ 'flags' ] ;
4542
46- // copy expected arguments from args to the new tokens object
47- // defaulting to an emptystring
48- var expectedKeys = [ 'flags' ] ;
49- for ( var key of expectedKeys ) {
50- // prepend keys with a dollar-sign for template-replacement
51- _tokens [ '$' + key ] = args [ key ] || '' ;
52- }
53-
54- return _tokens ;
43+ // shallow-copy the original tokens object
44+ for ( let key in tokens ) {
45+ _tokens [ key ] = tokens [ key ] ;
46+ }
47+
48+ // copy expected arguments from args to the new tokens object
49+ // defaulting to an emptystring
50+ for ( let key of expectedKeys ) {
51+ // prepend keys with a dollar-sign for template-replacement
52+ _tokens [ '$' + key ] = args [ key ] || '' ;
53+ }
54+
55+ return _tokens ;
5556}
5657
5758/**
@@ -67,7 +68,7 @@ function _replaceTokens(filePath, tokens) {
6768 function replace ( token , value ) {
6869 // tokens start with a $ which needs to be escaped, oops
6970 var _token = '\\' + token ,
70- // any '&' character needs to be escaped in the value,
71+ // any '&' character needs to be escaped in the value,
7172 // otherwise it is used as a backreference
7273 _value = value . replace ( / & / g, '\\&' ) ,
7374 // use commas as delims so that we don't need to escape value, which might be a URL
0 commit comments