Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to know the options of a shell/terminal command/application?

What I would like to know is, if there is any way to get the options used by a command or application (having no manual entry. For example:

For the application ScreenSaverEngine, located in:

/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/

has the option -background which allows me to set the current screensaver as a desktop background.

./ScreenSaverEngine -background

Now I would like to do other stuff with this application, or at least I would like to know if there is a possibility to do other stuff. So I want to know all the other options of ScreenSaverEngine. I thought maybe some options are coded in the app, so I tried something like

strings ScreenSaverEngine | grep "-"

but without results. ScreenSaverEngine doesn't have a manual, so

man ScreenSaverEngine

won't help. I'd be happy for any suggestions :-).

(By the way I'm using MAC OS X).

like image 343
justSaid Avatar asked Dec 21 '22 03:12

justSaid


1 Answers

For any arbitrary application, this is not possible, because the argv parameters passed to the program's main() function (in C) can be stored, parsed, and accessed any way the program wants. It could even write the parameters out to a file, and then read the file when it wants to know what options to use.

However, it looks like the command-line options are already documented. From CocoaDev:

The ScreenSaverEngine supports some special command line flags to aid in debugging:

-background -- All screen saver windows appear behind all other windows (behind Finder icons but in front of the desktop image). The password and gamma fade features are disabled. It will not exit on mouse or keyboard activity.

-debug -- Like -background, except mouse movement over the desktop causes it to exit. Very handy when running the ScreenSaverEngine in GDB. (Trying to get around my computer in this mode without causing it to exit reminds me of playing Don't Touch The Floor as a kid)

-module -- Loads the specified module rather than the module specified by the user defaults. accepts the same values as the moduleName node in ~/Library/Preferences/ByHost/com.apple.screensaver.*.plist For example, Flurry, Abstract, or Spectrum. It doesn't appear to accept full paths or URLs to .saver, .slideSaver, or .qtz files, however, so it's necessary to place the desired module in one of the typical ScreenSaver folders and reference it without the filename extension.

-window -- an additional command runs the screensaver in a window.

this can be combined with -background. example: -window -background

like image 118
Jacob Krall Avatar answered Apr 30 '23 23:04

Jacob Krall