LCOV - code coverage report
Current view: top level - include/esys/repo/exe - cmdmanifest.h (source / functions) Hit Total Coverage
Test: esysrepo_coverage.info Lines: 1 1 100.0 %
Date: 2026-08-01 10:43:40 Functions: 0 0 -

          Line data    Source code
       1             : /*!
       2             :  * \file esys/repo/exe/cmdmanifest.h
       3             :  * \brief Manifest command
       4             :  *
       5             :  * \cond
       6             :  * __legal_b__
       7             :  *
       8             :  * Copyright (c) 2021-2022 Michel Gillet
       9             :  * Distributed under the MIT License.
      10             :  * (See accompanying file LICENSE.txt or
      11             :  * copy at https://opensource.org/licenses/MIT)
      12             :  *
      13             :  * __legal_e__
      14             :  * \endcond
      15             :  *
      16             :  */
      17             : 
      18             : #pragma once
      19             : 
      20             : #include "esys/repo/esysrepo_defs.h"
      21             : #include "esys/repo/exe/cmd.h"
      22             : #include "esys/repo/git/commit.h"
      23             : 
      24             : #include <memory>
      25             : #include <ostream>
      26             : #include <vector>
      27             : 
      28             : namespace esys::repo::exe
      29             : {
      30             : 
      31             : /*! \class CmdManifest esys/repo/exe/cmdmanifest.h "esys/repo/exe/cmdmanifest.h"
      32             :  * \brief Manifest command
      33             :  */
      34             : class ESYSREPO_API CmdManifest : public Cmd
      35             : {
      36             : public:
      37             :     enum class Task
      38             :     {
      39             :         NOT_SET, //!< Not set
      40             :         REVISION_AS_HEAD, //!< Revision as head
      41             :         LIST_DIRS, //!< List dirs
      42             :         LIST_PROJECTS, //!< List projects
      43             :         ADD_DIR, //!< Add dir
      44             :         DEL_DIR, //!< Del dir
      45             :     };
      46             : 
      47          28 :     class ESYSREPO_API TaskDelDir
      48             :     {
      49             :     public:
      50             :         //! Constructor
      51             :         TaskDelDir();
      52             : 
      53             :         //! Set the name
      54             :         /*!
      55             :          * \param[in] name the name
      56             :          */
      57             :         void set_name(const std::string &name);
      58             :         const std::string &get_name() const;
      59             : 
      60             :     private:
      61             :         //!< \cond DOXY_IMPL
      62             :         std::string m_name;
      63             :         //!< \endcond
      64             :     };
      65             : 
      66             :     class ESYSREPO_API TaskAddDir : public TaskDelDir
      67             :     {
      68             :     public:
      69             :         //! Constructor
      70             :         TaskAddDir();
      71             : 
      72             :         //! Set the url ssh
      73             :         /*!
      74             :          * \param[in] url_ssh the url ssh
      75             :          */
      76             :         void set_url_ssh(const std::string &url_ssh);
      77             :         const std::string &get_url_ssh() const;
      78             : 
      79             :         //! Set the url https
      80             :         /*!
      81             :          * \param[in] url_https the url https
      82             :          */
      83             :         void set_url_https(const std::string &url_https);
      84             :         const std::string &get_url_https() const;
      85             : 
      86             :     private:
      87             :         //!< \cond DOXY_IMPL
      88             :         std::string m_url_ssh;
      89             :         std::string m_url_https;
      90             :         //!< \endcond
      91             :     };
      92             : 
      93             :     //! Default constructor
      94             :     CmdManifest();
      95             : 
      96             :     //! Destructor
      97             :     ~CmdManifest() override;
      98             : 
      99             :     //! Set the task
     100             :     /*!
     101             :      * \param[in] task the task
     102             :      */
     103             :     void set_task(Task task);
     104             : 
     105             :     //! Get the task
     106             :     /*!
     107             :      * \return the task
     108             :      */
     109             :     Task get_task() const;
     110             : 
     111             :     //! Set the task add dir
     112             :     /*!
     113             :      * \param[in] task_add_dir the task add dir
     114             :      */
     115             :     void set_task_add_dir(const TaskAddDir &task_add_dir);
     116             :     const TaskAddDir &get_task_add_dir() const;
     117             : 
     118             :     //! Set the task del dir
     119             :     /*!
     120             :      * \param[in] task_del_dir the task del dir
     121             :      */
     122             :     void set_task_del_dir(const TaskDelDir &task_del_dir);
     123             :     const TaskDelDir &get_task_del_dir() const;
     124             : 
     125             :     //! Set the dirs
     126             :     /*!
     127             :      * \param[in] dirs the dirs
     128             :      */
     129             :     void set_dirs(const std::string &dirs);
     130             :     const std::string &get_dirs() const;
     131             : 
     132             :     //! Set the output file
     133             :     /*!
     134             :      * \param[in] output_file the output file
     135             :      */
     136             :     void set_output_file(const std::string &output_file);
     137             :     const std::string &get_output_file() const;
     138             : 
     139             :     //! update revision as head
     140             :     Result update_revision_as_head();
     141             : 
     142             :     //! update revision as head
     143             :     /*!
     144             :      * \param[in] repo std::shared_ptr<manifest::Repository> repo
     145             :      */
     146             :     Result update_revision_as_head(std::shared_ptr<manifest::Repository> repo);
     147             : 
     148             :     //! do revision as head
     149             :     Result do_revision_as_head();
     150             : 
     151             :     //! do list dirs
     152             :     Result do_list_dirs();
     153             : 
     154             :     //! do list projects
     155             :     Result do_list_projects();
     156             : 
     157             :     //! do add dir
     158             :     Result do_add_dir();
     159             : 
     160             :     //! do del dir
     161             :     Result do_del_dir();
     162             : 
     163             : protected:
     164             :     //!< \cond DOXY_IMPL
     165             :     Result impl_run() override;
     166             : 
     167             : private:
     168             :     //!< \cond DOXY_IMPL
     169             :     Task m_task = Task::NOT_SET;
     170             :     std::string m_output_file;
     171             :     std::string m_dirs;
     172             :     TaskAddDir m_task_add_dir;
     173             :     TaskDelDir m_task_del_dir;
     174             :     //!< \endcond
     175             : };
     176             : 
     177             : } // namespace esys::repo::exe

Generated by: LCOV version 1.14