public static String SIGN_NO_PROFILES;
public static String SIGN_NO_SIGNING_PROFILE;
public static String SIGN_NO_CONFIG_PROFILES;
+
+ //LIST
+ public static String LIST_NO_DEVICE;
+ public static String LIST_CANNOT_GET_DEVICE_LIST;
}
SIGN_NO_PROFILES = There is no {0}.
SIGN_NO_SIGNING_PROFILE = No Signing profile {0} item in {1}.
-SIGN_NO_CONFIG_PROFILES = There is no default profiles value in config file.
\ No newline at end of file
+SIGN_NO_CONFIG_PROFILES = There is no default profiles value in config file.
+
+LIST_NO_DEVICE = There is no device.
+LIST_CANNOT_GET_DEVICE_LIST = Can not get the device list.
\ No newline at end of file
--- /dev/null
+/*
+ * IDE
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunsik Noh <hyunsik.noh@samsung.com>
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.ncli.ide.shell;
+
+import org.kohsuke.args4j.Argument;
+import org.kohsuke.args4j.spi.SubCommand;
+import org.kohsuke.args4j.spi.SubCommandHandler;
+import org.kohsuke.args4j.spi.SubCommands;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.ncli.core.TizenSubCommand;
+
+@TizenSubCommand(name="list" , usage="Show the list")
+public class ListCLI extends AbstractCLI{
+ private Logger log = LoggerFactory.getLogger(getClass());
+
+ @Argument(index = 0, required = true, handler = SubCommandHandler.class, usage = "Command is needed!")
+ @SubCommands({
+ @SubCommand(name = "device", impl = ListDeviceCLI.class)
+ })
+
+ private AbstractCLI tizenCLI;
+
+ @Override
+ public void execute() {
+ if( null != this.tizenCLI) {
+ this.tizenCLI.execute();
+ }
+
+ }
+
+}
--- /dev/null
+/*
+ * IDE
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunsik Noh <hyunsik.noh@samsung.com>
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.ncli.ide.shell;
+
+import org.kohsuke.args4j.Option;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.ncli.ide.subcommands.ListDevice;
+import org.tizen.ncli.ide.subcommands.ListDeviceCLICommand;
+
+public class ListDeviceCLI extends AbstractCLI{
+ private Logger log = LoggerFactory.getLogger(getClass());
+
+ @Option(name = "--detail", usage = "Details for device(Device Id/Type/Name)")
+ private boolean detail;
+
+ @Override
+ public void execute() {
+ log.trace("Execute ListDeviceCLI...");
+
+ ListDeviceCLICommand command = new ListDeviceCLICommand();
+ command.setWorkingDir(workingDir == null ? currentWorkspacePath : workingDir);
+ command.setDetail(detail);
+ ListDevice runCommand = command.runCommand();
+
+ }
+
+}
--- /dev/null
+/*
+ * IDE
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunsik Noh <hyunsik.noh@samsung.com>
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.ncli.ide.subcommands;
+
+public class ListDevice {
+
+}
--- /dev/null
+/*
+ * IDE
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunsik Noh <hyunsik.noh@samsung.com>
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.ncli.ide.subcommands;
+
+import org.tizen.common.core.application.InstallPathConfig;
+import org.tizen.common.util.HostUtil;
+import org.tizen.ncli.ide.messages.TizenCLIMessages;
+
+public class ListDeviceCLICommand extends AbstractSubCommand<ListDevice> {
+ private final String firstLine = "List of devices attached";
+
+ private boolean detail = false;
+
+ @Override
+ protected ListDevice call() {
+ String sdb = InstallPathConfig.getSDBPath();
+ String deviceCommand = sdb + " " + "devices";
+ String[] result = HostUtil.returnExecute(deviceCommand).split("\n");
+ if(firstLine.equals(result[0].trim())) {
+ int length = result.length;
+ if(length > 1) {
+ String device = null;
+ for(int i = 1; i < length; i++ ) {
+ if(detail) {
+ device = result[i];
+ } else {
+ device = result[i].split("\t")[0];
+ }
+ System.out.println(device);
+ }
+ } else {
+ System.out.println(TizenCLIMessages.LIST_NO_DEVICE);
+ }
+ } else {
+ System.out.println(TizenCLIMessages.LIST_CANNOT_GET_DEVICE_LIST);
+ }
+ return null;
+ }
+
+ public void setDetail(boolean detail) {
+ this.detail = detail;
+ }
+
+}