/* * px * Copyright (c) 2008 Shawn Hladky Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "pxheaders.h" #include "extendedcommands.h" #include "helpcommand.h" ErrorId help_usage = { ErrorOf( ES_CLIENT, 0, E_INFO, EV_USAGE, 0 ), "\n" " help -- Print help message\n" "\n" " px help [ command ... ]\n" "\n" " Print a help message about command. If no command name is given\n" " print a general help message about Perforce and give a list\n" " of available client commands.\n" "\n"}; void helpCommand::Run(ClientUser* cu, ClientApi* api, char *const *argv, int argc) { Options opts; Error e; StrPtr * s = 0; StrPtr * xfile = 0; int iargc = argc; char** iargv = (char**) argv; Error helpMsg; if (argc < 1) { helpMsg.Set(help_usage); cu->Message(&helpMsg); return; } StrRef cmd( iargv[0] ); pxBaseCommand* command = 0; // spin through the extended commands and see if we have a match for (int i=0; i < N_COMMANDS; i++) { if (cmd.Compare(*ExtendedCommands[i]->CommandString()) == 0) { command = ExtendedCommands[i]; } } if (command) { // We have an extended command, run it command->Help(&helpMsg); cu->Message(&helpMsg); } else { api->SetArgv( iargc, iargv ); api->Run( "help", cu ); } return; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 6351 | Shawn Hladky |
px: fixing -X flag. fixing help commands |
||
#1 | 6308 | Shawn Hladky | px: Initial submit |