77 "strings"
88
99 "github.com/codegangsta/cli"
10- "github.com/docker/machine/commands/mcndirs"
1110 "github.com/docker/machine/libmachine"
1211 "github.com/docker/machine/libmachine/crashreport"
1312 "github.com/docker/machine/libmachine/host"
@@ -16,6 +15,7 @@ import (
1615 "github.com/docker/machine/libmachine/mcnutils"
1716 "github.com/docker/machine/libmachine/persist"
1817 "github.com/docker/machine/libmachine/ssh"
18+ "github.com/lambda-linux/lambda-machine-local/commands/mcndirs"
1919)
2020
2121const (
@@ -192,211 +192,7 @@ func confirmInput(msg string) (bool, error) {
192192 return confirmed , nil
193193}
194194
195- var Commands = []cli.Command {
196- {
197- Name : "active" ,
198- Usage : "Print which machine is active" ,
199- Action : runCommand (cmdActive ),
200- Flags : []cli.Flag {
201- cli.IntFlag {
202- Name : "timeout, t" ,
203- Usage : fmt .Sprintf ("Timeout in seconds, default to %ds" , activeDefaultTimeout ),
204- Value : activeDefaultTimeout ,
205- },
206- },
207- },
208- {
209- Name : "config" ,
210- Usage : "Print the connection config for machine" ,
211- Description : "Argument is a machine name." ,
212- Action : runCommand (cmdConfig ),
213- Flags : []cli.Flag {
214- cli.BoolFlag {
215- Name : "swarm" ,
216- Usage : "Display the Swarm config instead of the Docker daemon" ,
217- },
218- },
219- },
220- {
221- Flags : SharedCreateFlags ,
222- Name : "create" ,
223- Usage : "Create a machine" ,
224- Description : fmt .Sprintf ("Run '%s create --driver name' to include the create flags for that driver in the help text." , os .Args [0 ]),
225- Action : runCommand (cmdCreateOuter ),
226- SkipFlagParsing : true ,
227- },
228- {
229- Name : "env" ,
230- Usage : "Display the commands to set up the environment for the Docker client" ,
231- Description : "Argument is a machine name." ,
232- Action : runCommand (cmdEnv ),
233- Flags : []cli.Flag {
234- cli.BoolFlag {
235- Name : "swarm" ,
236- Usage : "Display the Swarm config instead of the Docker daemon" ,
237- },
238- cli.StringFlag {
239- Name : "shell" ,
240- Usage : "Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh], default is auto-detect" ,
241- },
242- cli.BoolFlag {
243- Name : "unset, u" ,
244- Usage : "Unset variables instead of setting them" ,
245- },
246- cli.BoolFlag {
247- Name : "no-proxy" ,
248- Usage : "Add machine IP to NO_PROXY environment variable" ,
249- },
250- },
251- },
252- {
253- Name : "inspect" ,
254- Usage : "Inspect information about a machine" ,
255- Description : "Argument is a machine name." ,
256- Action : runCommand (cmdInspect ),
257- Flags : []cli.Flag {
258- cli.StringFlag {
259- Name : "format, f" ,
260- Usage : "Format the output using the given go template." ,
261- Value : "" ,
262- },
263- },
264- },
265- {
266- Name : "ip" ,
267- Usage : "Get the IP address of a machine" ,
268- Description : "Argument(s) are one or more machine names." ,
269- Action : runCommand (cmdIP ),
270- },
271- {
272- Name : "kill" ,
273- Usage : "Kill a machine" ,
274- Description : "Argument(s) are one or more machine names." ,
275- Action : runCommand (cmdKill ),
276- },
277- {
278- Name : "ls" ,
279- Usage : "List machines" ,
280- Action : runCommand (cmdLs ),
281- Flags : []cli.Flag {
282- cli.BoolFlag {
283- Name : "quiet, q" ,
284- Usage : "Enable quiet mode" ,
285- },
286- cli.StringSliceFlag {
287- Name : "filter" ,
288- Usage : "Filter output based on conditions provided" ,
289- Value : & cli.StringSlice {},
290- },
291- cli.IntFlag {
292- Name : "timeout, t" ,
293- Usage : fmt .Sprintf ("Timeout in seconds, default to %ds" , lsDefaultTimeout ),
294- Value : lsDefaultTimeout ,
295- },
296- cli.StringFlag {
297- Name : "format, f" ,
298- Usage : "Pretty-print machines using a Go template" ,
299- },
300- },
301- },
302- {
303- Name : "provision" ,
304- Usage : "Re-provision existing machines" ,
305- Action : runCommand (cmdProvision ),
306- },
307- {
308- Name : "regenerate-certs" ,
309- Usage : "Regenerate TLS Certificates for a machine" ,
310- Description : "Argument(s) are one or more machine names." ,
311- Action : runCommand (cmdRegenerateCerts ),
312- Flags : []cli.Flag {
313- cli.BoolFlag {
314- Name : "force, f" ,
315- Usage : "Force rebuild and do not prompt" ,
316- },
317- },
318- },
319- {
320- Name : "restart" ,
321- Usage : "Restart a machine" ,
322- Description : "Argument(s) are one or more machine names." ,
323- Action : runCommand (cmdRestart ),
324- },
325- {
326- Flags : []cli.Flag {
327- cli.BoolFlag {
328- Name : "force, f" ,
329- Usage : "Remove local configuration even if machine cannot be removed, also implies an automatic yes (`-y`)" ,
330- },
331- cli.BoolFlag {
332- Name : "y" ,
333- Usage : "Assumes automatic yes to proceed with remove, without prompting further user confirmation" ,
334- },
335- },
336- Name : "rm" ,
337- Usage : "Remove a machine" ,
338- Description : "Argument(s) are one or more machine names." ,
339- Action : runCommand (cmdRm ),
340- },
341- {
342- Name : "ssh" ,
343- Usage : "Log into or run a command on a machine with SSH." ,
344- Description : "Arguments are [machine-name] [command]" ,
345- Action : runCommand (cmdSSH ),
346- SkipFlagParsing : true ,
347- },
348- {
349- Name : "scp" ,
350- Usage : "Copy files between machines" ,
351- Description : "Arguments are [machine:][path] [machine:][path]." ,
352- Action : runCommand (cmdScp ),
353- Flags : []cli.Flag {
354- cli.BoolFlag {
355- Name : "recursive, r" ,
356- Usage : "Copy files recursively (required to copy directories)" ,
357- },
358- cli.BoolFlag {
359- Name : "delta, d" ,
360- Usage : "Reduce amount of data sent over network by sending only the differences (uses rsync)" ,
361- },
362- },
363- },
364- {
365- Name : "start" ,
366- Usage : "Start a machine" ,
367- Description : "Argument(s) are one or more machine names." ,
368- Action : runCommand (cmdStart ),
369- },
370- {
371- Name : "status" ,
372- Usage : "Get the status of a machine" ,
373- Description : "Argument is a machine name." ,
374- Action : runCommand (cmdStatus ),
375- },
376- {
377- Name : "stop" ,
378- Usage : "Stop a machine" ,
379- Description : "Argument(s) are one or more machine names." ,
380- Action : runCommand (cmdStop ),
381- },
382- {
383- Name : "upgrade" ,
384- Usage : "Upgrade a machine to the latest version of Docker" ,
385- Description : "Argument(s) are one or more machine names." ,
386- Action : runCommand (cmdUpgrade ),
387- },
388- {
389- Name : "url" ,
390- Usage : "Get the URL of a machine" ,
391- Description : "Argument is a machine name." ,
392- Action : runCommand (cmdURL ),
393- },
394- {
395- Name : "version" ,
396- Usage : "Show the Docker Machine version or a machine docker version" ,
397- Action : runCommand (cmdVersion ),
398- },
399- }
195+ var Commands = []cli.Command {}
400196
401197func printIP (h * host.Host ) func () error {
402198 return func () error {
@@ -415,16 +211,7 @@ func printIP(h *host.Host) func() error {
415211// We run commands concurrently and communicate back an error if there was one.
416212func machineCommand (actionName string , host * host.Host , errorChan chan <- error ) {
417213 // TODO: These actions should have their own type.
418- commands := map [string ](func () error ){
419- "configureAuth" : host .ConfigureAuth ,
420- "start" : host .Start ,
421- "stop" : host .Stop ,
422- "restart" : host .Restart ,
423- "kill" : host .Kill ,
424- "upgrade" : host .Upgrade ,
425- "ip" : printIP (host ),
426- "provision" : host .Provision ,
427- }
214+ commands := map [string ](func () error ){}
428215
429216 log .Debugf ("command=%s machine=%s" , actionName , host .Name )
430217
0 commit comments