+ case SEARCH:
+ if (searchOn == null) {
+ searchOn = SupportType.valueOfAllOkUC(args[i]);
+
+ if (searchOn == null) {
+ Instance.getTraceHandler().error(
+ "Website not known: <" + args[i] + ">");
+ exitCode = 41;
+ break;
+ }
+
+ if (BasicSearchable.getSearchable(searchOn) == null) {
+ Instance.getTraceHandler().error(
+ "Website not supported: " + searchOn);
+ exitCode = 42;
+ break;
+ }
+ } else if (search == null) {
+ search = args[i];
+ } else if (page != null && page == -1) {
+ try {
+ page = Integer.parseInt(args[i]);
+ } catch (Exception e) {
+ page = -2;
+ }
+ } else if (item != null && item == -1) {
+ try {
+ item = Integer.parseInt(args[i]);
+ } catch (Exception e) {
+ item = -2;
+ }
+ } else if (page == null || item == null) {
+ if (page == null && "page".equals(args[i])) {
+ page = -1;
+ } else if (item == null && "item".equals(args[i])) {
+ item = -1;
+ } else {
+ exitCode = 255;
+ }
+ } else {
+ exitCode = 255;
+ }
+ break;
+ case SEARCH_TAG:
+ if (searchOn == null) {
+ searchOn = SupportType.valueOfAllOkUC(args[i]);
+
+ if (searchOn == null) {
+ Instance.getTraceHandler().error(
+ "Website not known: <" + args[i] + ">");
+ exitCode = 255;
+ }
+
+ if (BasicSearchable.getSearchable(searchOn) == null) {
+ Instance.getTraceHandler().error(
+ "Website not supported: " + searchOn);
+ exitCode = 255;
+ }
+ } else if (page == null && item == null) {
+ if ("page".equals(args[i])) {
+ page = -1;
+ } else if ("item".equals(args[i])) {
+ item = -1;
+ } else {
+ try {
+ int index = Integer.parseInt(args[i]);
+ tags.add(index);
+ } catch (NumberFormatException e) {
+ Instance.getTraceHandler().error(
+ "Invalid tag index: " + args[i]);
+ exitCode = 255;
+ }
+ }
+ } else if (page != null && page == -1) {
+ try {
+ page = Integer.parseInt(args[i]);
+ } catch (Exception e) {
+ page = -2;
+ }
+ } else if (item != null && item == -1) {
+ try {
+ item = Integer.parseInt(args[i]);
+ } catch (Exception e) {
+ item = -2;
+ }
+ } else if (page == null || item == null) {
+ if (page == null && "page".equals(args[i])) {
+ page = -1;
+ } else if (item == null && "item".equals(args[i])) {
+ item = -1;
+ } else {
+ exitCode = 255;
+ }
+ } else {
+ exitCode = 255;
+ }
+ break;