xref: /haiku/src/bin/draggers.cpp (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
1 /*
2  * draggers - show/hide draggers from CLI
3  * (c) 2004, François Revol - revol@free.fr
4  */
5 
6 #include <stdio.h>
7 #include <string.h>
8 #include <Application.h>
9 #include <Dragger.h>
10 
11 
12 int main(int argc, char **argv)
13 {
14 	int i;
15 	BApplication app("application/x-vnd.Haiku-draggers");
16 	if (argc < 2) {
17 		printf("%s\n", BDragger::AreDraggersDrawn()?"shown":"hidden");
18 		return 0;
19 	}
20 	for (i = 1; i < argc; i++) {
21 		if (!strncmp(argv[i], "-h", 2)) {
22 			printf("draggers [show|hide]\n");
23 			printf("Shows/sets draggers state\n");
24 			return 0;
25 		}
26 		if (!strcmp(argv[i], "1")
27 		 || !strncmp(argv[i], "en", 2)
28 		 || !strncmp(argv[i], "sh", 2))
29 			BDragger::ShowAllDraggers();
30 		else if (!strcmp(argv[i], "0")
31 		 || !strncmp(argv[i], "di", 2)
32 		 || !strncmp(argv[i], "hi", 2))
33 			BDragger::HideAllDraggers();
34 	}
35 	return 0;
36 }
37