summaryrefslogtreecommitdiffstats
path: root/scripts/salsa.bash_completion
blob: 29a2c953b779ff62ad74157b37de1604a265b198 (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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# /usr/share/bash-completion/completions/salsa
# Bash command completion for ‘salsa(1)’.
# Documentation: ‘bash(1)’, section “Programmable Completion”.

shopt -s progcomp

_salsa_completion () {
    COMPREPLY=()

    local cur="${COMP_WORDS[COMP_CWORD]}"
    local prev="${COMP_WORDS[COMP_CWORD-1]}"

    local opts=""
# Source: ./lib/Devscripts/Config.pm:sub parse_command_line
    opts+=" --help"
# Source: ./lib/Devscripts/Output.pm:sub ds_prompt
    opts+=" --info"
# Source: ./lib/Devscripts/Config.pm:[...]$ARGV[0]
    opts+=" --conf-file --no-conf"
# Source: ./lib/Devscripts/Salsa/Config.pm:use constant keys
# Note: '<VALUE>!' == '--<VALUE> --no-<VALUE>', '<SHORT>|<LONG>'
# Headings: $ grep '^    #' ./lib/Devscripts/Salsa/Config.pm
    # General salsa
    opts+=" --chdir --cache-file --no-cache --path"
    # Responses
    opts+=" --yes --no-yes --no-fail"
    # Output
    opts+=" --verbose --no-verbose --debug --info"
    # General GitLab
    opts+=" --user --user-id --group --group-id --token --token-file"
    # List/search
    opts+=" --all --all-archived --archived --no-archived"
    opts+=" --skip --skip-file --no-skip"
    # Features
    opts+=" --analytics --auto-devops --container --environments"
    opts+=" --feature-flags --forks --infrastructure --issues --jobs --lfs"
    opts+=" --monitor --mr --packages --pages --releases --repo --service-desk"
    opts+=" --request-access --requirements --security-compliance "
    opts+=" --snippets --wiki"
    # Branding
    opts+=" --avatar-path --desc --no-desc --desc-pattern"
    # Notification
    opts+=" --email --no-email --disable-email --no-disable-email"
    opts+=" --email-recipient --irc-channel --irker --no-irker --disable-irker"
    opts+=" --no-disable-irker --irker-host --irker-port --kgb --no-kgb"
    opts+=" --disable-kgb --no-disable-kgb --kgb-options --tagpending"
    opts+=" --no-tagpending --disable-tagpending --no-disable-tagpending"
    # Branch
    opts+=" --rename-head --no-rename-head --source-branch --dest-branch"
    opts+=" --enable-remove-source-branch --no-enable-remove-source-branch"
    opts+=" --disable-remove-source-branch --no-disable-remove-source-branch"
    # Merge requests
    opts+=" --mr-allow-squash --no-mr-allow-squash --mr-desc --mr-dst-branch"
    opts+=" --mr-dst-project --mr-remove-source-branch"
    opts+=" --no-mr-remove-source-branch --mr-src-branch --mr-src-project"
    opts+=" --mr-title"
    # CI
    opts+=" --build-timeout --ci-config-path"
    # Pipeline schedules
    opts+=" --schedule-desc --schedule-ref --schedule-cron --schedule-tz"
    opts+=" --schedule-enable --no-schedule-enable --schedule-disable"
    opts+=" --no-schedule-disable --schedule-run --no-schedule-run"
    opts+=" --schedule-delete --no-schedule-delete"
    # Manage other GitLab instances
    opts+=" --api-url --git-server-url --irker-server-url --kgb-server-url"
    opts+=" --tagpending-server-url

# Source: ./lib/Devscripts/Salsa.pm:sub run -> $ ls ./lib/Devscripts/Salsa/*.pm
# Skipping: Config Hooks Repo -> `with "Devscripts::Salsa::<VALUE>";`
#           Then filter from: ./lib/Devscripts/Salsa.pm:use constant cmd_aliases -> Preferred terminology
    local commands=""
# Headings: $ grep '^=head' ./scripts/salsa.pl
    # Managing users and groups
    commands+=" add_user join list_groups update_user whoami"
    # Managing projects
    commands+=" checkout fork forks last_ci_status merge_request"
    commands+=" merge_requests pipeline_schedule pipeline_schedules"
    commands+=" protect_branch protected_branches push push_repo"
    commands+=" rename_branch update_safe"
    # Other
    commands+=" purge_cache"

# Aliases source: ./lib/Devscripts/Salsa.pm:use constant cmd_aliases -> Preferred terminology
    commands+=" check_projects create_project delete_project delete_user"
    commands+=" list_projects list_users search_groups search_projects "
    commands+=" search_users update_projects"

    # Disable completion for the arguments which require variables afterwards
    case "${prev}" in
      --api-url) ;&
      --desc-pattern) ;&
      --irc-channel) ;&
      --path) ;&
      --group-id) ;&
      --user-id)
      COMPREPLY=()
        ;;
      *)
        if [[ "$cur" == -* ]]; then
            COMPREPLY=( $( compgen -W "$opts" -- $cur ) )
        else
            COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
        fi
    ;;
    esac
    return 0
}

complete -F _salsa_completion salsa