File: migration.zsh

package info (click to toggle)
zplug 2.4.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 1,068 kB
  • sloc: sh: 1,504; awk: 235; makefile: 26
file content (60 lines) | stat: -rw-r--r-- 1,306 bytes parent folder | download | duplicates (4)
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
__zplug::core::migration::tags()
{
    local key="$1" new_key

    case "$key" in
        "of")
            new_key="use"
            ;;
        "file")
            new_key="rename-to"
            ;;
        "commit")
            new_key="at"
            ;;
        "do")
            new_key="hook-build"
            ;;
        "nice")
            new_key="defer"
            ;;
        *)
            # Not old tag
            __zplug::io::print::f \
                --die \
                --zplug \
                "$key: this tag is still good\n"
            return 1
    esac

    __zplug::io::print::f \
        --die \
        --zplug \
        --warn \
        "'%s' tag is deprecated. Please use '%s' tag instead (%s).\n" \
        "$fg[blue]$key$reset_color" \
        "$fg[blue]$new_key$reset_color" \
        "$fg[green]${name:gs:@::}$reset_color"

    return 1
}

__zplug::core::migration::pipe()
{
    __zplug::io::print::f \
        --die \
        --zplug \
        --warn \
        "pipe syntax is deprecated! Please use '%s' tag instead.\n" \
        "$fg[blue]on$reset_color"
    return 1
}

__zplug::core::migration::cache_file_dir()
{
    # If ZPLUG_CACHE_FILE is defined
    if [[ -f $ZPLUG_CACHE_DIR ]]; then
        rm -f "$ZPLUG_CACHE_DIR"
    fi
    mkdir -p "$ZPLUG_CACHE_DIR"
}