1 /*
   2     parted - a frontend to libparted
   3     Copyright (C) 1999, 2000, 2007 Free Software Foundation, Inc.
   4 
   5     This program is free software; you can redistribute it and/or modify
   6     it under the terms of the GNU General Public License as published by
   7     the Free Software Foundation; either version 3 of the License, or
   8     (at your option) any later version.
   9 
  10     This program is distributed in the hope that it will be useful,
  11     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13     GNU General Public License for more details.
  14 
  15     You should have received a copy of the GNU General Public License
  16     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17 */
  18 
  19 #ifndef COMMAND_H_INCLUDED
  20 #define COMMAND_H_INCLUDED
  21 
  22 #include <parted/parted.h>
  23 #include "strlist.h"
  24 
  25 typedef struct {
  26         StrList*        names;
  27         int             (*method) (PedDevice** dev);
  28         StrList*        summary;
  29         StrList*        help;
  30         int             non_interactive:1;
  31 } Command;
  32 
  33 extern Command* command_create (const StrList* names,
  34                                 int (*method) (PedDevice** dev),
  35                                 const StrList* summary,
  36                                 const StrList* help,
  37                                 int non_interactive);
  38 extern void command_destroy (Command* cmd);
  39 void command_register (Command** list, Command* cmd);
  40 
  41 extern Command* command_get (Command** list, char* name);
  42 extern StrList* command_get_names (Command** list);
  43 extern void command_print_summary (Command* cmd);
  44 extern void command_print_help (Command* cmd);
  45 extern int command_run (Command* cmd, PedDevice** dev);
  46 
  47 #endif /* COMMAND_H_INCLUDED */
  48