#include "session.h"
-
+#define DEFAULT_SETUP_WIZARD "org.tizen.krate-setup-wizard"
#define DEFAULT_SHELL "/bin/bash"
typedef std::pair<std::string, int> NamespacePair;
<< "Run a program in the krate" << std::endl
<< std::endl
<< "Options :" << std::endl
+ << " -c, --create=name create a new krate by given name" << std::endl
+ << " -d, --destroy=name destroy the krate" << std::endl
<< " -a, --attach=krate execute command in the krate" << std::endl
<< " -p, --pkginfo=krate show all packages in the krate" << std::endl
<< " -q, --appinfo=krate show all applications in the krate" << std::endl
::exit(EXIT_FAILURE);
}
+int showDefaultSetupWizard(const std::string& mode, const std::string& name)
+{
+ app_control_h app_control;
+ app_control_create(&app_control);
+ app_control_set_app_id(app_control, DEFAULT_SETUP_WIZARD);
+ app_control_add_extra_data(app_control, "mode", mode.c_str());
+ app_control_add_extra_data(app_control, "krate", name.c_str());
+ app_control_send_launch_request(app_control, NULL, NULL);
+ app_control_destroy(app_control);
+
+ std::cout << "Please do next steps on GUI" << std::endl;
+
+ return 0;
+}
+
int attachToKrate(const std::string& name, char* args[])
{
try {
int opt = 0, index, ret = 0;
struct option options[] = {
+ {"create", required_argument, 0, 'c'},
+ {"destroy", required_argument, 0, 'd'},
{"attach", required_argument, 0, 'a'},
- {"instance", no_argument, 0, 'l'},
+ {"instance", no_argument, 0, 'i'},
{"list", no_argument, 0, 'l'},
- {"state", required_argument, 0, 'l'},
+ {"state", required_argument, 0, 's'},
{"pkginfo", required_argument, 0, 'p'},
{"appinfo", required_argument, 0, 'q'},
{"krate-monitor", no_argument, 0, 'm'},
return EXIT_SUCCESS;
}
- while ((opt = getopt_long(argc, argv, "a:p:q:mn:s:ilh", options, &index)) != -1) {
+ while ((opt = getopt_long(argc, argv, "c:d:a:p:q:mn:s:ilh", options, &index)) != -1) {
switch (opt) {
+ case 'c':
+ ret = showDefaultSetupWizard("create", optarg);
+ break;
+ case 'd':
+ ret = showDefaultSetupWizard("remove", optarg);
+ break;
case 'a':
ret = attachToKrate(optarg, optind >= argc ? NULL : argv + optind);
break;