diff options
author | Naoto Hanaue <hanaue.naoto@po.ntts.co.jp> | 2015-10-21 19:29:49 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-10-26 15:51:26 +0900 |
commit | f7f62904162a6e40b7c47f04fb44d31c4c58482a (patch) | |
tree | 6ecc56408406ad6d12b72d6ba7079f8781769855 /tools/completion/gobgp-completion.bash | |
parent | cfff5dea9e6ff45e1e7e7499c78e82e757b2a15a (diff) |
cli: fix bash completion in order to respond to dynamic complementary
Diffstat (limited to 'tools/completion/gobgp-completion.bash')
-rw-r--r-- | tools/completion/gobgp-completion.bash | 1056 |
1 files changed, 1050 insertions, 6 deletions
diff --git a/tools/completion/gobgp-completion.bash b/tools/completion/gobgp-completion.bash index ddc0e9a7..e665c0c5 100644 --- a/tools/completion/gobgp-completion.bash +++ b/tools/completion/gobgp-completion.bash @@ -1,5 +1,117 @@ #!/bin/bash +__gobgp_q() +{ + gobgp 2>/dev/null "$@" +} + +__gobgp_q_neighbor() +{ + neighbors=( $(__gobgp_q $url $port --quiet neighbor) ) + case "${neighbors[*]}" in + "grpc: timed out"* | "rpc error:"* ) + req_faild="True" + return + ;; + esac + for n in ${neighbors[*]}; do + commands+=($n) + done + searched="True" +} + +__gobgp_q_vrf() +{ + vrfs=( $(__gobgp_q $url $port --quiet vrf) ) + case "${vrfs[*]}" in + "grpc: timed out"* | "rpc error:"* ) + req_faild="True" + return + ;; + esac + for n in ${vrfs[*]}; do + commands+=($n) + done + searched="True" +} + +__gobgp_q_policy() +{ + local parg=$1 + policies=( $(__gobgp_q $url $port --quiet policy $parg) ) + case "${policies[*]}" in + "grpc: timed out"* | "rpc error:"* ) + req_faild="True" + return + ;; + esac + for ps in ${policies[*]}; do + commands+=($ps) + done + searched="True" +} + +__gobgp_q_statement() +{ + local pol=$1 + statements=( $(__gobgp_q $url $port --quiet policy statement ) ) + case "${statements[*]}" in + "grpc: timed out"* | "rpc error:"* ) + req_faild="True" + return + ;; + esac + for sts in ${statements[*]}; do + commands+=($sts) + done + searched="True" +} + +__handle_gbp_command() +{ + if [[ ${searched} == "True" ]]; then + case "${last_command}" in + gobgp_neighbor ) + next_command="_${last_command}_addr" + ;; + gobgp_policy_prefix_* | gobgp_policy_neighbor_* | gobgp_policy_as-path_* | gobgp_policy_community_* | gobgp_policy_ext-community_* ) + next_command="__gobgp_null" + ;; + gobgp_policy_del | gobgp_policy_set ) + next_command="__gobgp_null" + ;; + gobgp_policy_statement ) + if [[ ${words[c]} == "del" || ${words[c]} == "add" ]]; then + return + fi + next_command="_gobgp_policy_statement_sname" + ;; + gobgp_policy_statement_del ) + next_command="__gobgp_null" + ;; + *_condition_prefix | *_condition_neighbor | *_condition_as-path | *_condition_community | *_ext-condition_community ) + next_command="__gobgp_null" + ;; + gobgp_vrf ) + if [[ ${words[c]} == "del" || ${words[c]} == "add" ]]; then + return + fi + next_command="_global_vrf_vname" + ;; + gobgp_vrf_del ) + next_command="__gobgp_null" + ;; + gobgp_mrt_dump_rib_neighbor ) + next_command="__gobgp_null" + ;; + gobgp_monitor_neighbor ) + next_command="__gobgp_null" + ;; + esac + through="True" + fi +} + __debug() { if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then @@ -120,6 +232,12 @@ __handle_flag() fi fi + if [ ${words[(c-1)]} == "-u" ]; then + url="-u ${words[(c)]}" + fi + if [ ${words[(c-1)]} == "-p" ]; then + port="-p ${words[(c)]}" + fi # skip the flag itself c=$((c+1)) @@ -140,16 +258,27 @@ __handle_noun() __handle_command() { __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}" - - local next_command - if [[ -n ${last_command} ]]; then - next_command="_${last_command}_${words[c]}" - else - next_command="_${words[c]}" + # echo "${FUNCNAME}: c is $c words[c] is ${words[c]} searched is ${searched} through ${through}" + next_command="" + through="False" + __handle_gbp_command + searched="False" + if [[ ${through} == "False" ]]; then + if [[ -n ${last_command} ]]; then + next_command="_${last_command}_${words[c]}" + else + next_command="_${words[c]}" + fi fi + c=$((c+1)) __debug "${FUNCNAME}: looking for ${next_command}" + # echo "${FUNCNAME}: looking for ${next_command} searched is ${searched} through ${through}" declare -F $next_command >/dev/null && $next_command + + if [[ ${req_faild} == "True" ]]; then + next_command="__gobgp_null" + fi } __handle_word() @@ -169,6 +298,21 @@ __handle_word() __handle_word } +__gobgp_null() +{ + last_command="gobgp_null" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + _gobgp_global_rib_add() { last_command="gobgp_global_rib_add" @@ -442,6 +586,399 @@ _gobgp_global() must_have_one_noun=() } +_gobgp_neighbor_addr_local() +{ + last_command="gobgp_neighbor_addr_local" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--address-family=") + two_word_flags+=("-a") + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_adj-in() +{ + last_command="gobgp_neighbor_addr_adj-in" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--address-family=") + two_word_flags+=("-a") + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_adj-out() +{ + last_command="gobgp_neighbor_addr_adj-out" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--address-family=") + two_word_flags+=("-a") + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_reset() +{ + last_command="gobgp_neighbor_addr_reset" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_softreset() +{ + last_command="gobgp_neighbor_addr_softreset" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_softresetin() +{ + last_command="gobgp_neighbor_addr_softresetin" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_softresetout() +{ + last_command="gobgp_neighbor_addr_softresetout" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_shutdown() +{ + last_command="gobgp_neighbor_addr_shutdown" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_enable() +{ + last_command="gobgp_neighbor_addr_enable" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_disable() +{ + last_command="gobgp_neighbor_addr_disable" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_policy_in_add() +{ + last_command="gobgp_neighbor_addr_policy_in_add" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_policy_in_del() +{ + last_command="gobgp_neighbor_addr_policy_in_del" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_policy_in_set() +{ + last_command="gobgp_neighbor_addr_policy_in_set" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_policy_in() +{ + last_command="gobgp_neighbor_addr_policy_in" + commands=() + commands+=("add") + commands+=("del") + commands+=("set") + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_policy_import_add() +{ + last_command="gobgp_neighbor_addr_policy_import_add" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_policy_import_del() +{ + last_command="gobgp_neighbor_addr_policy_import_del" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_policy_import_set() +{ + last_command="gobgp_neighbor_addr_policy_import_set" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_policy_import() +{ + last_command="gobgp_neighbor_addr_policy_import" + commands=() + commands+=("add") + commands+=("del") + commands+=("set") + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_policy_export_add() +{ + last_command="gobgp_neighbor_addr_policy_export_add" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_policy_export_del() +{ + last_command="gobgp_neighbor_addr_policy_export_del" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_policy_export_set() +{ + last_command="gobgp_neighbor_addr_policy_export_set" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_policy_export() +{ + last_command="gobgp_neighbor_addr_policy_export" + commands=() + commands+=("add") + commands+=("del") + commands+=("set") + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr_policy() +{ + last_command="gobgp_neighbor_addr_policy" + commands=() + commands+=("in") + commands+=("import") + commands+=("export") + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_neighbor_addr() +{ + last_command="gobgp_neighbor_addr" + commands=() + commands+=("local") + commands+=("adj-in") + commands+=("adj-out") + commands+=("reset") + commands+=("softreset") + commands+=("softresetin") + commands+=("softresetout") + commands+=("shutdown") + commands+=("enable") + commands+=("disable") + commands+=("policy") + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--address-family=") + two_word_flags+=("-a") + flags+=("--help") + flags+=("-h") + + must_have_one_flag=() + must_have_one_noun=() +} + _gobgp_neighbor() { last_command="gobgp_neighbor" @@ -459,6 +996,54 @@ _gobgp_neighbor() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_neighbor +} + +_global_vrf_vname_rib_del() +{ + last_command="global_vrf_vname_rib_del" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_global_vrf_vname_rib() +{ + last_command="global_vrf_vname_rib" + commands=() + commands+=("del") + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_global_vrf_vname() +{ + last_command="global_vrf_vname" + commands=() + commands+=("rib") + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() } _gobgp_vrf_add() @@ -489,6 +1074,7 @@ _gobgp_vrf_del() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_vrf } _gobgp_vrf() @@ -508,6 +1094,7 @@ _gobgp_vrf() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_vrf } _gobgp_policy_prefix_add() @@ -538,6 +1125,7 @@ _gobgp_policy_prefix_del() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_policy "prefix" } _gobgp_policy_prefix_set() @@ -553,6 +1141,7 @@ _gobgp_policy_prefix_set() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_policy "prefix" } _gobgp_policy_prefix() @@ -601,6 +1190,7 @@ _gobgp_policy_neighbor_del() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_policy "neighbor" } _gobgp_policy_neighbor_set() @@ -616,6 +1206,7 @@ _gobgp_policy_neighbor_set() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_policy "neighbor" } _gobgp_policy_neighbor() @@ -664,6 +1255,7 @@ _gobgp_policy_as-path_del() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_policy "as-path" } _gobgp_policy_as-path_set() @@ -679,6 +1271,7 @@ _gobgp_policy_as-path_set() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_policy "as-path" } _gobgp_policy_as-path() @@ -727,6 +1320,7 @@ _gobgp_policy_community_del() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_policy "community" } _gobgp_policy_community_set() @@ -742,6 +1336,7 @@ _gobgp_policy_community_set() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_policy "community" } _gobgp_policy_community() @@ -790,6 +1385,7 @@ _gobgp_policy_ext-community_del() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_policy "ext-community" } _gobgp_policy_ext-community_set() @@ -805,6 +1401,7 @@ _gobgp_policy_ext-community_set() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_policy "ext-community" } _gobgp_policy_ext-community() @@ -825,6 +1422,439 @@ _gobgp_policy_ext-community() must_have_one_noun=() } +_gobgp_policy_statement_sname_ope_condition_prefix() +{ + last_command="gobgp_policy_statement_sname_ope_condition_prefix" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() + __gobgp_q_policy "prefix" +} + +_gobgp_policy_statement_sname_ope_condition_neighbor() +{ + last_command="gobgp_policy_statement_sname_ope_condition_neighbor" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() + __gobgp_q_policy "neighbor" +} + +_gobgp_policy_statement_sname_ope_condition_as-path() +{ + last_command="gobgp_policy_statement_sname_ope_condition_as-path" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() + __gobgp_q_policy "as-path" +} + +_gobgp_policy_statement_sname_ope_condition_community() +{ + last_command="gobgp_policy_statement_sname_ope_condition_community" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() + __gobgp_q_policy "community" +} + +_gobgp_policy_statement_sname_ope_condition_ext-community() +{ + last_command="gobgp_policy_statement_sname_ope_condition_ext-community" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() + __gobgp_q_policy "ext-community" +} + +_gobgp_policy_statement_sname_ope_condition_as-path-length() +{ + last_command="gobgp_policy_statement_sname_ope_condition_as-path-length" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope_condition_rpki_valid() +{ + last_command="gobgp_policy_statement_sname_ope_condition_rpki_valid" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope_condition_rpki_invalid() +{ + last_command="gobgp_policy_statement_sname_ope_condition_rpki_invalid" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope_condition_rpki_not-found() +{ + last_command="gobgp_policy_statement_sname_ope_condition_rpki_not-found" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope_condition_rpki() +{ + last_command="gobgp_policy_statement_sname_ope_condition_rpki" + commands=() + commands+=("valid") + commands+=("invalid") + commands+=("not-found") + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + + +_gobgp_policy_statement_sname_ope_condition() +{ + last_command="gobgp_policy_statement_sname_ope_condition" + commands=() + commands+=("prefix") + commands+=("neighbor") + commands+=("as-path") + commands+=("community") + commands+=("ext-community") + commands+=("as-path-length") + commands+=("rpki") + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope_action_reject() +{ + last_command="gobgp_policy_statement_sname_ope_action_reject" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope_action_accept() +{ + last_command="gobgp_policy_statement_sname_ope_action_accept" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope_action_communities_add() +{ + last_command="gobgp_policy_statement_sname_ope_action_communities_add" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope_action_communities_remove() +{ + last_command="gobgp_policy_statement_sname_ope_action_communities_remove" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope_action_communities_replace() +{ + last_command="gobgp_policy_statement_sname_ope_action_communities_replace" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope_action_communities() +{ + last_command="gobgp_policy_statement_sname_ope_action_communities" + commands=() + commands+=("add") + commands+=("remove") + commands+=("replace") + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope_action_community() +{ + _gobgp_policy_statement_sname_ope_action_communities +} + +_gobgp_policy_statement_sname_ope_action_ext-community() +{ + _gobgp_policy_statement_sname_ope_action_communities +} + +_gobgp_policy_statement_sname_ope_action_med_add() +{ + last_command="gobgp_policy_statement_sname_ope_action_med_add" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope_action_med_sub() +{ + last_command="gobgp_policy_statement_sname_ope_action_med_sub" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope_action_med_set() +{ + last_command="gobgp_policy_statement_sname_ope_action_med_set" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope_action_med() +{ + last_command="gobgp_policy_statement_sname_ope_action_med" + commands=() + commands+=("add") + commands+=("sub") + commands+=("set") + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope_action_as-prepend() +{ + last_command="gobgp_policy_statement_sname_ope_action_as-prepend" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope_action() +{ + last_command="gobgp_policy_statement_sname_ope_action" + commands=() + commands+=("reject") + commands+=("accept") + commands+=("community") + commands+=("ext-community") + commands+=("med") + commands+=("as-prepend") + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_ope() +{ + last_command="gobgp_policy_statement_sname_ope" + commands=() + commands+=("condition") + commands+=("action") + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + +_gobgp_policy_statement_sname_add() +{ + _gobgp_policy_statement_sname_ope +} + +_gobgp_policy_statement_sname_del() +{ + _gobgp_policy_statement_sname_ope +} + +_gobgp_policy_statement_sname_set() +{ + _gobgp_policy_statement_sname_ope +} + +_gobgp_policy_statement_sname() +{ + last_command="gobgp_policy_statement_sname" + commands=() + commands+=("add") + commands+=("del") + commands+=("set") + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() +} + _gobgp_policy_statement_add() { last_command="gobgp_policy_statement_add" @@ -853,6 +1883,7 @@ _gobgp_policy_statement_del() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_statement } _gobgp_policy_statement() @@ -870,6 +1901,7 @@ _gobgp_policy_statement() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_statement } _gobgp_policy_add() @@ -900,6 +1932,7 @@ _gobgp_policy_del() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_policy "" } _gobgp_policy_set() @@ -915,6 +1948,7 @@ _gobgp_policy_set() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_policy "" } _gobgp_policy() @@ -987,6 +2021,7 @@ _gobgp_monitor_neighbor() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_neighbor } _gobgp_monitor() @@ -1034,6 +2069,7 @@ _gobgp_mrt_dump_rib_neighbor() must_have_one_flag=() must_have_one_noun=() + __gobgp_q_neighbor } _gobgp_mrt_dump_rib() @@ -1174,6 +2210,9 @@ _gobgp_rpki() _gobgp() { + url="" + port="" + q_type="" last_command="gobgp" commands=() commands+=("global") @@ -1202,6 +2241,8 @@ _gobgp() two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") + flags+=("--help") + flags+=("-h") must_have_one_flag=() must_have_one_noun=() @@ -1227,6 +2268,9 @@ __start_gobgp() local last_command local nouns=() + req_faild="False" + searched="False" + through="False" __handle_word } |