grabc
grabc copied to clipboard
[Feature request] Support `--help` arg
It would be nice if the help text was shown when --help
is passed in, rather than just -h
.
When I first installed this, I tried man grabc
, but that didn't work. Then I tried grabc --help
, but that didn't work either, so I assumed that this program didn't take args at all until I came here and read the readme.
The latest v1.0.2 does print help message with -h
. You have to compile it yourself however. I will make package for ubuntu available when get some time. The version in ubuntu is very old.
Example:
$ grabc -h
grabc v1.0.2
A program to identify a pixel color of an X Window
by [email protected] https://www.muquit.com/
Usage: grabc [options]
Where the options are:
-v - show version info
-h - show this usage
-hex - print pixel value as Hex on stdout
-rgb - print pixel value as RGB on stderr
-W - print the Window id at mouse click
-w id - window id in hex, use -l +x+y
-l +x+y - pixel co-ordinate. requires window id
-d - show debug messages
-a - Print all 16 bits of color. Default is high order 8 bits
Example:
* Print pixel color in hex on stdout:
$ grabc
* Show usage:
$ grabc -h
* Print Window Id (Note the upper case W):
$ grabc -W
* Print pixel color of Window iwith id 0x13234 at location 10,20
$ grabc -w 0x13234 -l +10+20
Yeah, I know that -h
works. It would be nice if the help text was also shown when --help
is passed in, rather than just -h
.
This patch does it for me, but I don't want to pressure anyone with a pull-request from a C-noob <.<
@muquit : Let me know If you want that little hack as a pull-request for convenient merging.
diff --git a/grabc.c b/grabc.c
index 91a5ec0..b93e61f 100644
--- a/grabc.c
+++ b/grabc.c
@@ -458,6 +458,10 @@ int main(int argc,char **argv)
for (i=1; i < argc; i++)
{
option = argv[i];
+ if(*(option+1) == '-') {
+ // Move over one char when its double '-'
+ option++;
+ }
switch(*(option+1))
{
case 'a':
In Action: