aboutsummaryrefslogtreecommitdiff
path: root/bdep/release-parsers.cxx
blob: 5ad8cd702a2f31461df51fa7b6a0e5a371776fdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// file      : bdep/release-parsers.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

#include <bdep/release-parsers.hxx>

#include <bdep/release-options.hxx> // bdep::cli namespace

namespace bdep
{
  namespace cli
  {
    void parser<cmd_release_current_tag>::
    parse (cmd_release_current_tag& r, bool& xs, scanner& s)
    {
      const char* o (s.next ());

      if (!s.more ())
        throw missing_value (o);

      string v (s.next ());

      if      (v == "keep")   r = cmd_release_current_tag::keep;
      else if (v == "update") r = cmd_release_current_tag::update;
      else if (v == "remove") r = cmd_release_current_tag::remove;
      else throw invalid_value (o, v);

      xs = true;
    }
  }
}