At the minimum, nShell commands contain a code resource (of type "NSHC") and two version resources (of type "vers"). Commands may also contain man pages (of type "TEXT") and custom resources.
Code Resource Types
-------------------
The nShell environment supports single-segment code resources. The code resource for a command should have a type of "NSHC" and a name of "command".
Version Resources
-----------------
nShell commands contain two "vers" resources. Resource I.D. #1 is used to specify which version of the nShell application the command was written for. Resource I.D. #2 is used to specify the version of the command itself.
Please follow these rules when creating "vers" resources:
1. Make the I.D. #1 resource match that of the application exactly.
2. Make the major revision portion of the I.D. #2 resource match the major revision of the application exactly. (If for example, the application had a version of a.b.c, please make your version a.x.x)
The nShell uses these version resources to determine which interface should be used when calling your command.
Man Page Resources
------------------
To create a "man page" for your command, create a "TEXT" resource with an I.D. of 16000 or above, and a name of "man general". You can use ResEdit to create this resource and type in the text directly.
When the user types "man my_command", the man program will open my_command and read in the "man general" resource. This resource is then listed to standard output.
If you would like to create supplemental man pages, give them resource I.D.s above 16000 and names in the format "man subject".
When the user types "man my_command something", the man program will open my_command and read in the "man something" resource. This resource is then listed to standard output.
Other Resources
---------------
You may include any other resources you like with your command. Just give them I.D.s above 16000.
Please note however, that the nShell detaches commands and closes the resource file before calling your main. If you want to get a resource, use arg[0] to locate and open the file. (See the source for the "man" command for an example of the technique.)