summaryrefslogtreecommitdiff
path: root/Base/usr/share/shell/completion/proxy.sh
blob: 2179cd42ba779e856db157db57e65114eb16d3d2 (plain)
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
#!/bin/Shell

__proxy() {
    echo '{"kind":"proxy","argv":"'"${regex_replace '"' '\"' "$*"}"'"}'
}

# Builtins
_complete_time() {
    shift 2
    argsparser_parse \
        --add-option _ --help-string "Number of iterations" \
          --long-name iterations --short-name n --value-name iterations --type u32 \
        --add-positional-argument argv --help-string _ \
          --value-name _ --min 0 --max 9999999 \
        --stop-on-first-non-option \
        -- $*
    __proxy $argv
}

# Utilities
_complete_pls() {
    shift 2
    argsparser_parse \
        --add-option _ --help-string "User to execute as" --short-name u --value-name UID \
        --add-positional-argument argv --help-string "Command to run at elevated privilege level" \
          --value-name command --min 0 --max 999999 \
        --stop-on-first-non-option \
        -- $*
    __proxy $argv
}