2 * Copyright 2007, Ingo Weinhold, bonefish@cs.tu-berlin.de.
3 * Distributed under the terms of the MIT License.
9 #include "compatibility.h"
14 #include "fssh_defs.h"
17 typedef fssh_status_t
command_function(int argc
, const char* const* argv
);
24 COMMAND_RESULT_EXIT
= 1,
31 Command(const char* name
,
32 const char* description
);
33 Command(command_function
* function
,
34 const char* name
, const char* description
);
37 const char* Name() const;
38 const char* Description() const;
40 virtual fssh_status_t
Do(int argc
, const char* const* argv
);
44 std::string fDescription
;
45 command_function
* fFunction
;
50 class CommandManager
{
55 static CommandManager
* Default();
57 void AddCommand(Command
* command
);
58 void AddCommand(command_function
* function
,
59 const char* name
, const char* description
);
60 void AddCommands(command_function
* function
,
61 const char* name
, const char* description
,
63 Command
* FindCommand(const char* name
) const;
64 void ListCommands() const;
67 typedef std::map
<std::string
, Command
*> CommandMap
;
71 static CommandManager
* sManager
;
75 extern void register_additional_commands(void);
78 } // namespace FSShell
81 #endif // _FSSH_FSSH_H