# HG changeset patch # User atton # Date 1448448181 -32400 # Node ID 8a086917cf1a13bf5b121304a29b0193faaca740 # Parent c908e2c7315d75ef5a7cdf4e93a89fbd99e3f650 WIP: built all commands string diff -r c908e2c7315d -r 8a086917cf1a ie-docker.c --- a/ie-docker.c Tue Nov 24 17:31:55 2015 +0900 +++ b/ie-docker.c Wed Nov 25 19:43:01 2015 +0900 @@ -215,12 +215,13 @@ usage() { printf("Usage: ie-docker\n"); - printf("\trun: run process\n"); - printf("\tbuild: build docker process from Dockerfile\n"); - printf("\tattach: attach process\n"); - printf("\tdettach: dettach process\n"); - printf("\timages: list images\n"); - printf("\tcommit: \n"); + printf(" ps: show running containers\n"); + printf(" run: create new container\n"); + printf(" start: start created container\n"); + printf(" stop: stop running container\n"); + printf(" attach: attach running container\n"); + printf(" cp : copy file into container (/tmp) \n"); + printf(" rm: delete container\n"); } void @@ -290,22 +291,27 @@ print_pslist(pslist); // TODO check work correctly } else if (command_is_matched(argv[1], run_command)) { sprintf(execl_command, "%s %s %s --name %s %s %s", - base_exec_command, run_command, "-it -u 2015 ", name, "java-centos", "zsh"); //FIXME - printf(execl_command); // TODO + base_exec_command, run_command, run_options, name, base_image_name, run_shell); } else if (command_is_matched(argv[1], start_command)) { - printf("start"); // TODO + sprintf(execl_command, "%s %s %s", base_exec_command, start_command, name); } else if (command_is_matched(argv[1], stop_command)) { - printf("stop"); // TODO + sprintf(execl_command, "%s %s %s", base_exec_command, stop_command, name); } else if (command_is_matched(argv[1], attach_command)) { - printf("attach"); // TODO + sprintf(execl_command, "%s %s %s", base_exec_command, attach_command, name); } else if (command_is_matched(argv[1], rm_command)) { - printf("rm"); // TODO + sprintf(execl_command, "%s %s %s", base_exec_command, rm_command, name); } else if (command_is_matched(argv[1], cp_command)) { - printf("cp"); // TODO + if (argc<3) { + printf("cp command requires file path\n"); + return 0; + } + sprintf(execl_command, "%s %s %s %s:%s", base_exec_command, cp_command, argv[2], name, cp_file_path); } else { usage(); return 0; } + printf(execl_command); + printf("\n"); free(execl_command); return 0; } diff -r c908e2c7315d -r 8a086917cf1a ie-docker.h --- a/ie-docker.h Tue Nov 24 17:31:55 2015 +0900 +++ b/ie-docker.h Wed Nov 25 19:43:01 2015 +0900 @@ -20,6 +20,11 @@ #define create_command "" +#define run_options "-it -u 2015 " +#define base_image_name "java-centos" +#define run_shell "zsh" +#define cp_file_path "/tmp" + /* Define global variables */ const char *guests[] = {"mata"};