SuperCard Shell Essentials

 

Command Documentation

Page history last edited by DCS 3 yrs ago

Command Documentation

 

The Man Command

Commonly referred to as 'man pages', command documentation is available via the 'man' command.

 

To read the documentation for the 'date' command...

Launch the terminal.app, and type 'man date' (without quotes) followed by a carriage return.

Spacebar to advance a page at a time.

Return key to advance a line at a time.

Up and down arrow keys allow scrolling.

Type 'q' to terminate 'man' session followed by command-K to clear scrollback.

 

Or... use following SuperCard function.

 

function shellMan commandName
return shell(merge("man [[commandName]] | col -b"))
end shellMan

 

Or... download a simple WebKit viewer project... WebKit_ManPageBrowser.zip

 

 

Case matters to 'man'

Command names are typically all lower case.

 

Help Switches

Many commands include an option to simply return a brief help text.

The following SuperCard function will try the 2 most common help switches.

Note: The following example is not reliable, as -v, -V, -h, -H mean different things to different commands

Attempt to get version info and help text of the named command.
On failure, open console application where error and help text may have been posted.
--
function shellCmdVersionHelp commandName
put "_name=" & commandName & " ; " &¬
"$_name -v && $_name -h || " &¬
"$_name --version  && $_name --help || " into cmd
put merge("osascript -e 'tell application `console` to activate' ; ") after cmd
return shell(cmd)
end shellCmdVersionHelp

Comments (0)

You don't have permission to comment on this page.