Browse Source

yutani-query: add command-based interface

K. Lange 2 years ago
parent
commit
d40340ec13
1 changed files with 14 additions and 0 deletions
  1. 14 0
      apps/yutani-query.c

+ 14 - 0
apps/yutani-query.c

@@ -57,15 +57,29 @@ int main(int argc, char * argv[]) {
 			case 'q':
 				quiet = 1;
 				break;
+
+			/* Legacy options */
 			case 'r':
 				return show_resolution();
 			case 'e':
 				return reload();
+
 			case '?':
 				show_usage(argc,argv);
 				return 0;
 		}
 	}
 
+	if (optind < argc) {
+		if (!strcmp(argv[optind], "resolution")) {
+			return show_resolution();
+		} else if (!strcmp(argv[optind], "reload")) {
+			return reload();
+		} else {
+			fprintf(stderr, "%s: unsupported command: %s\n", argv[0], argv[optind]);
+			return 1;
+		}
+	}
+
 	return 0;
 }