LCOV - code coverage report
Current view: top level - src/esys/repo/cli - cmdmulti_cli.cpp (source / functions) Hit Total Coverage
Test: esysrepo_coverage.info Lines: 4 29 13.8 %
Date: 2026-08-12 14:26:50 Functions: 2 6 33.3 %

          Line data    Source code
       1             : /*!
       2             :  * \file esys/repo/cli/cmdmulti_cli.cpp
       3             :  * \brief
       4             :  *
       5             :  * \cond
       6             :  * __legal_b__
       7             :  *
       8             :  * Copyright (c) 2023 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             : #include "esys/repo/esysrepo_prec.h"
      19             : #include "esys/repo/cli/cmdmulti.h"
      20             : 
      21             : #include <esys/md/rend/styled_string.h>
      22             : 
      23             : #include <termcolor/termcolor.hpp>
      24             : 
      25             : #include <vector>
      26             : 
      27             : namespace esys::repo::cli
      28             : {
      29             : 
      30             : #include "esys/repo/cli/cmdmulti_doc.cpp"
      31             : 
      32          16 : CmdMulti::CmdMulti(AppBase *app)
      33          32 :     : BaseType(app, "multi", "Handle branches from multiple repositories")
      34             : {
      35          16 : }
      36             : 
      37          16 : CmdMulti::~CmdMulti() = default;
      38             : 
      39           0 : int CmdMulti::configure_cmd(CmdType &cmd)
      40             : {
      41           0 :     if (get_vm().count("capture"))
      42           0 :         cmd.set_task(CmdType::Task::CAPTURE);
      43           0 :     else if (get_vm().count("show"))
      44           0 :         cmd.set_task(CmdType::Task::SHOW);
      45           0 :     else if (get_vm().count("delete"))
      46           0 :         cmd.set_task(CmdType::Task::DELETE);
      47           0 :     else if (get_vm().count("push"))
      48           0 :         cmd.set_task(CmdType::Task::PUSH);
      49             : 
      50           0 :     return 0;
      51             : }
      52             : 
      53           0 : std::shared_ptr<po::options_description> CmdMulti::get_desc()
      54             : {
      55           0 :     auto desc = Cmd::get_desc();
      56           0 :     if (desc != nullptr) return desc;
      57             : 
      58           0 :     desc = std::make_shared<po::options_description>("Multi options");
      59             :     // clang-format off
      60           0 :     desc->add_options()
      61           0 :         ("capture,c", "capture the branch different from manifest for all repositories")
      62           0 :         ("show,s", "show the captured branches")
      63           0 :         ("delete,d", "delete the captured branches")
      64           0 :         ("push,p", "push the captured branches")
      65             :         ;
      66             :     // clang-format on
      67           0 :     Cmd::set_desc(desc);
      68           0 :     return desc;
      69           0 : }
      70             : 
      71           0 : int CmdMulti::print_doc(std::ostream &os)
      72             : {
      73           0 :     os << cmdmulti_doc_strings;
      74           0 :     return 0;
      75             : }
      76             : 
      77             : } // namespace esys::repo::cli

Generated by: LCOV version 1.14