@@ -5,7 +5,6 @@ local M = {}
55
66local category = " Component generation"
77
8- local executable = Util .get_sf_executable ()
98local prompt_for_name_and_dir = function (name_prompt , directory_prompt )
109 local lwc_name = vim .fn .input (name_prompt )
1110 local directory = vim .fn .input (directory_prompt , vim .fn .expand (" %:p:h" ), " dir" )
@@ -38,7 +37,10 @@ local component_creation_callback = function(job)
3837
3938 if sfdx_response .status == 0 then
4039 Util .clear_and_notify (
41- string.format (" Successfully created in dir: %s" , sfdx_response .result .outputDir )
40+ string.format (
41+ " Successfully created component in directory: %s" ,
42+ sfdx_response .result .outputDir
43+ )
4244 )
4345 else
4446 Util .clear_and_notify (
@@ -74,16 +76,21 @@ M.create_lightning_component = function()
7476 else
7577 type = " lwc"
7678 end
77- local command = string.format (
78- " %s lightning generate component --name %s --type %s --output-dir %s --json" ,
79- executable ,
79+ local args = {
80+ " lightning" ,
81+ " generate" ,
82+ " component" ,
83+ " --name" ,
8084 name ,
85+ " --type" ,
8186 type ,
82- dir
83- )
87+ " --output-dir" ,
88+ dir ,
89+ " --json" ,
90+ }
8491 Util .clear_and_notify (" Creating component..." )
8592 Util .send_cli_command (
86- command ,
93+ args ,
8794 component_creation_callback ,
8895 category ,
8996 " component_generator.lua"
@@ -117,16 +124,19 @@ M.create_apex = function()
117124 else
118125 type = " trigger"
119126 end
120- local command = string.format (
121- " %s apex generate %s --name %s --output-dir %s --json " ,
122- executable ,
127+ local args = {
128+ " apex" ,
129+ " generate " ,
123130 type ,
131+ " --name" ,
124132 name ,
125- dir
126- )
133+ " --output-dir" ,
134+ dir ,
135+ " --json" ,
136+ }
127137 Util .clear_and_notify (" Creating component..." )
128138 Util .send_cli_command (
129- command ,
139+ args ,
130140 component_creation_callback ,
131141 category ,
132142 " component_generator.lua"
0 commit comments