aboutsummaryrefslogtreecommitdiff
path: root/src/option.cc
blob: 2cae4ef178f0aa7c7de80d8c8066bf7b237f029e (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

#include "option.h"

#include <string>
#include <iostream>

#include "global.h"
#include "util/io.h"
#include "util/prompt.h"

using namespace std;

namespace ov4::option
{
    
void v(string s)
{
    if (s == "" || s == "true" || s == "1")
    {
        ov4::verbose = true;
        LOG << "verbose = true" << endl;
        return;
    }
    if (s == "false" || s == "0")
    {
        ov4::verbose = false;
        LOG << "verbose = flase" << endl;
        return;
    }
    LOG << "-v: invalid value" << endl;
}

void p(string s)
{
    if (s == "" || s == "true" || s == "1")
    {
        ov4::emit_prompt = true;
        LOG << "emit_prompt = true" << endl;
        return;
    }
    if (s == "false" || s == "0")
    {
        ov4::emit_prompt = false;
        LOG << "emit_prompt = flase" << endl;
        return;
    }
    LOG << "-p: invalid value" << endl;
}


/*
 * usage - print a help message
 */
void h([[maybe_unused]] string s)
{
    cout << "\
Usage: ccshell [-hvp] \n\
    -h                  print this message \n\
    -v(=<bool>)         print additional diagnostic information \n\
    -p(=<bool>)         do not emit a command prompt \
" << endl;
    exit(1);
}

}