aboutsummaryrefslogtreecommitdiffstats
path: root/ydb/public/lib/ydb_cli/common/root.h
blob: 6ccd4cce46d447c627179380929d566188036f7e (plain) (blame)
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
#pragma once

#include "command.h"

namespace NYdb {
namespace NConsoleClient {

extern const TString defaultTokenFile;

class TClientCommandRootBase : public TClientCommandTree {
public:
    TClientCommandRootBase(const TString& name);

    bool TimeRequests;
    bool ProgressRequests;
    TString Address;
    TString Token;
    TString TokenFile;
    TString CaCertsFile;

    virtual void Config(TConfig& config) override;
    virtual void Parse(TConfig& config) override;
    void SetCustomUsage(TConfig& config) override;
    void SetFreeArgs(TConfig& config) override;

protected:
    void ParseToken(TString& token, TString& tokenFile, const TString& envName, bool useDefaultToken = false);
    bool ParseProtocol(TConfig& config, TString& message);
    virtual void ParseCaCerts(TConfig& config);
    virtual void ParseCredentials(TConfig& config);
    virtual void ParseAddress(TConfig& config) = 0;
};

}
}