source: trunk/eraser/Eraser.Manager/IConfigurer.cs @ 2232

Revision 2232, 2.3 KB checked in by lowjoel, 4 years ago (diff)

Make the generation of help text for addtask parameters done by the plugins, since the arguments are passed to them, they should document their own CLIs. To do this, the ICliConfigurer interface was modified.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1/*
2 * $Id$
3 * Copyright 2008-2010 The Eraser Project
4 * Original Author: Joel Low <lowjoel@users.sourceforge.net>
5 * Modified By:
6 *
7 * This file is part of Eraser.
8 *
9 * Eraser is free software: you can redistribute it and/or modify it under the
10 * terms of the GNU General Public License as published by the Free Software
11 * Foundation, either version 3 of the License, or (at your option) any later
12 * version.
13 *
14 * Eraser is distributed in the hope that it will be useful, but WITHOUT ANY
15 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 *
18 * A copy of the GNU General Public License can be found at
19 * <http://www.gnu.org/licenses/>.
20 */
21
22using System;
23using System.Collections.Generic;
24using System.Linq;
25using System.Text;
26
27namespace Eraser.Manager
28{
29    /// <summary>
30    /// Represents an object which is able to configure a given instance of
31    /// <typeparamref name="T"/> with some sort of user interaction.
32    /// </summary>
33    /// <typeparam name="T">The type to configure</typeparam>
34    public interface IConfigurer<T>
35    {
36        /// <summary>
37        /// Loads the configuration from the provided object.
38        /// </summary>
39        /// <param name="target">The object to load the configuration from.</param>
40        void LoadFrom(T target);
41
42        /// <summary>
43        /// Configures the provided object.
44        /// </summary>
45        /// <param name="target">The object to configure.</param>
46        /// <returns>True if the configuration was valid and the save operation
47        /// succeeded.</returns>
48        bool SaveTo(T target);
49    }
50
51    /// <summary>
52    /// Represents an object which is able to configure a given instance of
53    /// <typeparamref name="T"/> from the Command Line.
54    /// </summary>
55    /// <typeparam name="T">The type to configure</typeparam>
56    public interface ICliConfigurer<T> : IConfigurer<T>
57    {
58        /// <summary>
59        /// Gets the help string for the current configurer.
60        /// </summary>
61        string Help();
62
63        /// <summary>
64        /// Sets the configuration of the current configurer from the provided
65        /// command line argument.
66        /// </summary>
67        /// <param name="argument">The argument on the command line.</param>
68        /// <returns>True if the argument is accepted by the configurer.</returns>
69        bool ProcessArgument(string argument);
70    }
71}
Note: See TracBrowser for help on using the repository browser.