NBash

Форк
0
76 строк · 2.3 Кб
1
#!/bin/sh
2
#
3
# Copyright (C) 2022, 2023  Etersoft
4
# Copyright (C) 2022, 2023  Vitaly Lipatov <lav@etersoft.ru>
5
#
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU Affero General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU Affero General Public License for more details.
15
#
16
# You should have received a copy of the GNU Affero General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
#
19

20
epm_tool_help()
21
{
22
    echo "Tools embedded in epm:"
23
    get_help HELPCMD $SHAREDIR/epm-tool
24

25
    cat <<EOF
26
  Examples:
27
    epm tool eget -U http://ya.ru
28
    epm tool estrlist union a b a c
29
    epm tool erc archive.zip
30
EOF
31
}
32

33
epm_tool()
34
{
35
    local WHAT="$1"
36
    shift
37

38
    case "$WHAT" in
39
        "")
40
            fatal "Use epm tool --help to get help."
41
            ;;
42
        "-h"|"--help"|"help")
43
            epm_tool_help
44
            ;;
45
        "eget")                      # HELPCMD: downloading tool (simular to wget or curl)
46
            showcmd eget "$@"
47
            eget "$@"
48
            ;;
49
        "erc")                       # HELPCMD: universal archive manager
50
            showcmd erc "$@"
51
            erc "$@"
52
            ;;
53
        "ercat")                     # HELPCMD: universal file uncompressor
54
            showcmd ercat "$@"
55
            ercat "$@"
56
            ;;
57
        "estrlist")                  # HELPCMD: string operations
58
            showcmd estrlist "$@"
59
            estrlist "$@"
60
            ;;
61
        "json")                      # HELPCMD: json operations
62
            showcmd json "$@"
63
            $CMDSHELL $SHAREDIR/tools_json "$@"
64
            ;;
65
        "yaml")                      # HELPCMD: parse yaml operations
66
            showcmd yaml "$@"
67
            $CMDSHELL $SHAREDIR/tools_yaml "$@"
68
            ;;
69
        "which")
70
            print_command_path "$@"  # HELPCMD: which like command (no output to stderr, can works without which package)
71
            ;;
72
        *)
73
            fatal "Unknown command $ epm tool $WHAT. Use epm print help for get help."
74
            ;;
75
    esac
76
}
77

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.