shellMain.c 1.4 KB
Newer Older
H
hzcheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

16
#define __USE_XOPEN
17
#include "shellInt.h"
18

19
SShellObj shell = {0};
20

21 22
int main(int argc, char *argv[]) {
  if (shellCheckIntSize() != 0) {
23
    return -1;
H
hzcheng 已提交
24
  }
25 26

  if (shellParseArgs(argc, argv) != 0) {
27
    return -1;
H
hzcheng 已提交
28
  }
29 30 31

  if (shell.args.is_version) {
    shellPrintVersion();
H
hzcheng 已提交
32 33 34
    return 0;
  }

35 36 37
  if (shell.args.is_gen_auth) {
    shellGenerateAuth();
    return 0;
H
hzcheng 已提交
38 39
  }

40
  if (shell.args.is_help) {
41
    shellPrintHelp();
42
    return 0;
43
  }
S
Shengliang Guan 已提交
44

45 46 47 48
  if (shell.args.is_dump_config) {
    shellDumpConfig();
    taos_cleanup();
    return 0;
H
hzcheng 已提交
49 50
  }

51 52 53 54
  if (shell.args.is_startup || shell.args.is_check) {
    shellCheckServerStatus();
    taos_cleanup();
    return 0;
D
dapan1121 已提交
55 56
  }

57
  if (shell.args.netrole != NULL) {
58 59 60
    shellTestNetWork();
    taos_cleanup();
    return 0;
H
hzcheng 已提交
61
  }
S
Shengliang Guan 已提交
62

63
  return shellExecute();
S
Shengliang Guan 已提交
64
}