File: __load__

package info (click to toggle)
zplug 2.4.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,068 kB
  • sloc: sh: 1,504; awk: 235; makefile: 26
file content (74 lines) | stat: -rw-r--r-- 1,606 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env zsh
# Description:
#   Source installed plugins and add installed commands to $PATH

__zplug::core::load::prepare

local    repo arg
local -a repos
local -A tags

repos=( "${(k)zplugs[@]}" )

while (( $# > 0 ))
do
    arg="$1"
    case "$arg" in
        --verbose)
            zstyle ':zplug:core:load' 'verbose' yes
            ;;
        -*|--*)
            __zplug::core::options::unknown "$arg"
            return $status
            ;;
        "")
            # Invalid
            return 1
            ;;
        */*)
            repos+=( "${arg:gs:@::}" )
            ;;
        *)
            return 1
            ;;
    esac
    shift
done

# Check if cache is up-to-date
if __zplug::core::cache::diff; then
    __zplug::core::load::from_cache
    return $status
fi

for repo in "${repos[@]}"
do
    # Generate cache for each as:type in parallel
    {
        tags[as]="$(__zplug::core::core::run_interfaces 'as' "$repo")"

        case "$tags[as]" in
            "plugin")
                __zplug::core::cache::plugins "$repo"
                ;;
            "command")
                __zplug::core::cache::commands "$repo"
                ;;
            "theme")
                __zplug::core::cache::themes "$repo"
                ;;
            *)
                __zplug::io::print::f \
                    --die \
                    --zplug \
                    --func \
                    "as tag is invalid value (%s)\n" \
                    "$fg[green]$repo$reset_color"
                ;;
        esac
    } &
done
wait

__zplug::core::load::from_cache
return $status