Quellcode durchsuchen

default to an xgeometry compliant format

naelstrof vor 7 Jahren
Ursprung
Commit
f119dc80d7
1 geänderte Dateien mit 4 neuen und 9 gelöschten Zeilen
  1. 4
    9
      src/main.cpp

+ 4
- 9
src/main.cpp Datei anzeigen

@@ -117,7 +117,7 @@ void printHelp() {
117 117
 	std::cout << "                                  (default=`simple')\n";
118 118
 	std::cout << "  -f, --format=STRING           Set the output format string. Format specifiers\n";
119 119
 	std::cout << "                                  are %x, %y, %w, %h, %i, %g, and %c.\n";
120
-	std::cout << "                                  (default=`X=%x\nY=%y\nW=%w\nH=%h\nG=%g\nID=%i\nCancel=%c\n')\n";
120
+	std::cout << "                                  (default=`%g\n')\n";
121 121
 	std::cout << "Examples\n";
122 122
 	std::cout << "    $ # Gray, thick, transparent border for maximum visiblity.\n";
123 123
 	std::cout << "    $ slop -b 20 -c 0.5,0.5,0.5,0.8\n";
@@ -131,12 +131,8 @@ void printHelp() {
131 131
 	std::cout << "    $ # Classic Windows XP selection.\n";
132 132
 	std::cout << "    $ slop -l -c 0.3,0.4,0.6,0.4\n";
133 133
 	std::cout << "\n";
134
-	std::cout << "    $ # Change output format to use safer parsing\n";
135
-	std::cout << "    $ slopoutput=$(slop -f \"%x %y %w %h\")\n";
136
-	std::cout << "    $ X=$(echo $slopoutput | awk '{print $1}')\n";
137
-	std::cout << "    $ Y=$(echo $slopoutput | awk '{print $2}')\n";
138
-	std::cout << "    $ W=$(echo $slopoutput | awk '{print $3}')\n";
139
-	std::cout << "    $ H=$(echo $slopoutput | awk '{print $4}')\n";
134
+	std::cout << "    $ # Read slop output for use in scripts.\n";
135
+	std::cout << "    $ read -r X Y W H G ID < <(slop -f '%x %y %w %h %g %i')\n";
140 136
 	std::cout << "\n";
141 137
 	std::cout << "Tips\n";
142 138
 	std::cout << "    * If you don't like a selection: you can cancel it by right-clicking\n";
@@ -186,8 +182,7 @@ int app( int argc, char** argv ) {
186 182
         std::cout << formatOutput( format, selection );
187 183
         return 0;
188 184
     }
189
-    // Otherwise we default to an `eval` compatible format.
190
-    std::cout << formatOutput( "X=%x\nY=%y\nW=%w\nH=%h\nG=%g\nID=%i\n", selection );
185
+    std::cout << formatOutput( "%g\n", selection );
191 186
     return 0;
192 187
 }
193 188