@@ -1820,7 +1820,7 @@ def prepare_command(self, **kwargs):
18201820 self ._run ()
18211821
18221822 def platform_on_done (self , platform ):
1823- self .placeholders [":platform" ] = shlex .quote (platform )
1823+ self .placeholders [":platform" ] = shlex .quote (platform . strip () )
18241824 self .command = self .substitute_placeholders (self .command )
18251825 self ._run ()
18261826
@@ -1916,7 +1916,7 @@ def prepare_command(self, **kwargs):
19161916 self ._run ()
19171917
19181918 def platform_on_done (self , platform ):
1919- self .placeholders [":platform" ] = shlex .quote (platform )
1919+ self .placeholders [":platform" ] = shlex .quote (platform . strip () )
19201920 self .command = self .substitute_placeholders (self .command )
19211921 self ._run ()
19221922
@@ -2014,7 +2014,7 @@ def prepare_command(self, **kwargs):
20142014 self ._run ()
20152015
20162016 def platform_on_done (self , platform ):
2017- self .placeholders [":platform" ] = shlex .quote (platform )
2017+ self .placeholders [":platform" ] = shlex .quote (platform . strip () )
20182018 self .command = self .substitute_placeholders (self .command )
20192019 self ._run ()
20202020
@@ -2102,13 +2102,13 @@ class angularv1_cliCommand(manage_cliCommand):
21022102
21032103 def prepare_command (self , ** kwargs ):
21042104
2105- if self . command [ 0 ] in [ "angular:controller" , "angular:directive" , "angular:filter" , "angular:route" , "angular:service" , "angular:provider" , "angular:factory" , "angular:value" , "angular:constant" , "angular:decorator" , "angular:view" ] :
2105+ if ":name" in self . command :
21062106 sublime .active_window ().show_input_panel ( (self .command [0 ].replace ("angular:" , "" ))+ " name:" , "" , self .name_on_done , None , None )
21072107 else :
21082108 self ._run ()
21092109
21102110 def name_on_done (self , name ):
2111- self .placeholders [":name" ] = shlex .quote (name )
2111+ self .placeholders [":name" ] = shlex .quote (name . strip () )
21122112 self .command = self .substitute_placeholders (self .command )
21132113 self ._run ()
21142114
@@ -2191,29 +2191,34 @@ class angularv2_cliCommand(manage_cliCommand):
21912191
21922192 def prepare_command (self , ** kwargs ):
21932193
2194- # if self.command[0] in ["angular:controller", "angular:directive", "angular:filter", "angular:route", "angular:service", "angular:provider", "angular:factory", "angular:value", "angular:constant", "angular:decorator", "angular:view"]:
2195- # sublime.active_window().show_input_panel( (self.command[0].replace("angular:", ""))+" name:", "", self.name_on_done, None, None )
2196- # else :
2197- # self._run()
2198-
2199- self ._run ()
2194+ if ":name_and_options" in self .command :
2195+ sublime .active_window ().show_input_panel ( self .command [0 ] + " " + self .command [1 ] + " name and options:" , "" , self .name_and_options_on_done , None , None )
2196+ else :
2197+ self ._run ()
22002198
2201- def name_on_done (self , name ):
2202- self .placeholders [":name " ] = shlex . quote ( name )
2199+ def name_and_options_on_done (self , name_and_options ):
2200+ self .placeholders [":name_and_options " ] = name_and_options . strip ( )
22032201 self .command = self .substitute_placeholders (self .command )
22042202 self ._run ()
22052203
22062204 def _run (self ):
2207- # try:
2208- # self.command = {
2209- # 'serve': lambda : self.command + self.settings["angularv2_settings"]
2210- # }[self.command[0]]()
2211- # except KeyError as err:
2212- # pass
2213- # except Exception as err:
2214- # print(traceback.format_exc())
2215- # pass
22162205
2206+ try :
2207+ self .command = {
2208+ 'build' : lambda : self .command + self .settings ["angularv2_settings" ]["platform_run_options" ][self .command [2 ].replace ('--' , '' )],
2209+ 'serve' : lambda : self .command + self .settings ["angularv2_settings" ]["serve_options" ],
2210+ 'lint' : lambda : self .command + self .settings ["angularv2_settings" ]["lint_options" ],
2211+ 'test' : lambda : self .command + self .settings ["angularv2_settings" ]["test_options" ],
2212+ 'e2e' : lambda : self .command + self .settings ["angularv2_settings" ]["e2e_options" ],
2213+ 'eject' : lambda : self .command + self .settings ["angularv2_settings" ]["eject_options" ],
2214+ 'xi18n' : lambda : self .command + self .settings ["angularv2_settings" ]["xi18n_options" ]
2215+ }[self .command [0 ]]()
2216+ except KeyError as err :
2217+ pass
2218+ except Exception as err :
2219+ print (traceback .format_exc ())
2220+ pass
2221+
22172222 super (angularv2_cliCommand , self )._run ()
22182223
22192224
0 commit comments