Logo Search packages:      
Sourcecode: schroot version File versions  Download package

schroot-options.h

/* Copyright © 2005-2006  Roger Leigh <rleigh@debian.org>
 *
 * schroot is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * schroot is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA  02111-1307  USA
 *
 *********************************************************************/

#ifndef SCHROOT_OPTIONS_H
#define SCHROOT_OPTIONS_H

#include <string>
#include <vector>

#include "sbuild-session.h"
#include "sbuild-types.h"

namespace schroot
{

  /**
   * schroot command-line options.
   */
00035   class options
  {
  public:
    /// The action to perform.
00039     enum action_type
      {
00041       ACTION_SESSION_AUTO,    ///< Begin, run and end a session.
00042       ACTION_SESSION_BEGIN,   ///< Begin a session.
00043       ACTION_SESSION_RECOVER, ///< Recover an existing session.
00044       ACTION_SESSION_RUN,     ///< Run an existing session.
00045       ACTION_SESSION_END,     ///< End an existing session.
00046       ACTION_VERSION,         ///< Display program version.
00047       ACTION_LIST,            ///< Display a list of chroots.
00048       ACTION_INFO,            ///< Display chroot information.
00049       ACTION_LOCATION,        ///< Display chroot location information.
00050       ACTION_CONFIG           ///< Display chroot configuration.
      };

    /**
     * The constructor.
     *
     * @param argc the number of arguments.
     * @param argv the list of arguments.
     */
    options (int   argc,
           char *argv[]);

    /// The destructor.
    virtual ~options ();

    /// The action to perform.
00066     action_type          action;
    /// Chroots to use.
00068     sbuild::string_list  chroots;
    /// Chroot to print path.
00070     std::string          chroot_path;
    /// Command to run.
00072     sbuild::string_list  command;
    /// User to run as.
00074     std::string          user;
    /// Preserve environment.
00076     bool                 preserve;
    /// Quiet messages.
00078     bool                 quiet;
    /// Verbose messages.
00080     bool                 verbose;
    /// Use all chroots and sessions.
00082     bool                 all;
    /// Use all chroots.
00084     bool                 all_chroots;
    /// Use all sessions.
00086     bool                 all_sessions;
    /// Load chroots.
00088     bool                 load_chroots;
    /// Load sessions.
00090     bool                 load_sessions;
    /// Force session operations.
00092     bool                 session_force;
    /// dchroot(1) compatibility mode.
00094     bool                 dchroot_compat;

  private:
    /**
     * Set action.  This detects if an action has already been set
     * (only one action may be specified at once).
     *
     * @param action the action to set.
     */
    void
    set_action (action_type action);

    /**
     * Check if any of the --all options have been used.
     *
     * @returns true if any of the options have been used, otherwise
     * false.
     */
    bool
00113     all_used () const
    {
      return (this->all || this->all_chroots || this->all_sessions);
    }

  };

}

#endif /* SCHROOT_OPTIONS_H */

/*
 * Local Variables:
 * mode:C++
 * End:
 */


Generated by  Doxygen 1.6.0   Back to index