rharder / imagesnap

Capture Images from the Command Line
https://github.com/rharder/imagesnap
458 stars 50 forks source link

Support --help and --version/-V flags; ignore invalid flags #35

Open ryandesign opened 3 years ago

ryandesign commented 3 years ago

Unexpectedly, imagesnap ignores unknown flags and does not know several standard flags.


$ imagesnap --version
Changed waitThread to realtime priority!
Asked for all format descriptions...
Capturing image from device "EpocCam"...Asked for all format descriptions...
[setting] Setting kCMIODevicePropertyDeviceMaster to 55109
[setting] Setting kCMIOStreamPropertyFormatDescription
Got new format : 1920x1080
[setting] Setting kCMIODevicePropertyDeviceMaster to -1
[setting] Setting kCMIODevicePropertyDeviceMaster to 55109
[setting] Setting kCMIODevicePropertyDeviceMaster to -1
Asked for all format descriptions...
[RemoteFrameSource] Releasing RemoteFrameSource
snapshot.jpg
[RemoteFrameSource] Releasing RemoteFrameSource

I expected this to print something like "ImageSnap 0.2.10". imagesnap -V could be added as a synonym.


$ imagesnap --help
Changed waitThread to realtime priority!
Asked for all format descriptions...
Capturing image from device "EpocCam"...Asked for all format descriptions...
[setting] Setting kCMIODevicePropertyDeviceMaster to 55144
[setting] Setting kCMIOStreamPropertyFormatDescription
Got new format : 1920x1080
[setting] Setting kCMIODevicePropertyDeviceMaster to -1
[setting] Setting kCMIODevicePropertyDeviceMaster to 55144
[setting] Setting kCMIODevicePropertyDeviceMaster to -1
Asked for all format descriptions...
[RemoteFrameSource] Releasing RemoteFrameSource
snapshot.jpg
[RemoteFrameSource] Releasing RemoteFrameSource

I expected this to tell me what command line flags are available, just like imagesnap -h already does.


$ imagesnap --foo
Changed waitThread to realtime priority!
Asked for all format descriptions...
Capturing image from device "EpocCam"...Asked for all format descriptions...
[setting] Setting kCMIODevicePropertyDeviceMaster to 55197
[setting] Setting kCMIOStreamPropertyFormatDescription
Got new format : 1920x1080
[setting] Setting kCMIODevicePropertyDeviceMaster to -1
[setting] Setting kCMIODevicePropertyDeviceMaster to 55197
[setting] Setting kCMIODevicePropertyDeviceMaster to -1
Asked for all format descriptions...
[RemoteFrameSource] Releasing RemoteFrameSource
snapshot.jpg
[RemoteFrameSource] Releasing RemoteFrameSource

I expected this to exit with an error saying that the flag --foo is unknown.

rharder commented 3 years ago

True, that would be more standard behavior. I think I'll incorporate that in a future release. Thanks for bringing it to my attention.