|
|
为了让nova 命令可以补全,因为有些时候,命令可能记不住,可以尝试使用此方法设置,当然自己开发的环境可能就自带:0 G! k2 Y8 H0 H" L5 Z. s
切换到/etc/bash_completion.d目录下:
& R1 ]6 V& {0 q# D7 i0 C+ c
. u' \# p- Z& G; V创建文件vim nova.bash_completion
0 @% R8 C, N" S2 w8 }. t7 T% V9 S, s2 B2 h8 E! N3 V
' E. `* s0 K8 U: e1 L/ ?$ A/ `_nova()* Y& E+ i- d+ ?! i. S, u
{
' a5 W1 H9 Q9 J5 B6 o1 M9 k1 V' j1 ` local cur prev words; l2 V# s' E5 y% {0 ~' r
COMPREPLY=(), u7 D8 N* x3 \( M+ i v5 u7 x
_get_comp_words_by_ref -n : cur prev words$ U/ Z& d/ z8 _, Y
# Command data:8 n1 ^5 e3 y6 k9 o
cmds='add-secgroup agent-create agent-delete agent-list agent-modify aggregate-add-host aggregate-cache-images aggregate-create aggregate-delete aggregate-list aggregate-remove-host aggregate-set-metadata aggregate-show aggregate-update availability-zone-list backup boot clear-password console-log delete diagnostics evacuate flavor-access-add flavor-access-list flavor-access-remove flavor-create flavor-delete flavor-key flavor-list flavor-show flavor-update force-delete get-mks-console get-password get-rdp-console get-serial-console get-spice-console get-vnc-console host-evacuate host-evacuate-live host-meta host-servers-migrate hypervisor-list hypervisor-servers hypervisor-show hypervisor-stats hypervisor-uptime image-create instance-action instance-action-list instance-usage-audit-log interface-attach interface-detach interface-list keypair-add keypair-delete keypair-list keypair-show limits list list-secgroup live-migration live-migration-abort live-migration-force-complete lock meta migrate migration-list pause quota-class-show quota-class-update quota-defaults quota-delete quota-show quota-update reboot rebuild refresh-network remove-secgroup rescue reset-network reset-state resize resize-confirm resize-revert restore resume server-group-create server-group-delete server-group-get server-group-list server-migration-list server-migration-show server-tag-add server-tag-delete server-tag-delete-all server-tag-list server-tag-set server-topology service-delete service-disable service-enable service-force-down service-list set-password shelve shelve-offload show ssh start stop suspend trigger-crash-dump unlock unpause unrescue unshelve update usage usage-list version-list volume-attach volume-attachments volume-detach volume-update bash-completion help --version --debug --os-cache --timings --os-region-name --service-type --service-name --os-endpoint-type --os-compute-api-version --os-endpoint-override --os-auth-type --insecure --os-cacert --os-cert --os-key --timeout --collect-timing --os-auth-url --os-system-scope --os-domain-id --os-domain-name --os-project-id --os-project-name --os-project-domain-id --os-project-domain-name --os-trust-id --os-default-domain-id --os-default-domain-name --os-user-id --os-username --os-user-domain-id --os-user-domain-name --os-password'9 E+ R8 a1 u% i2 F% c9 Q5 e: r
cmds_flavor='create delete list set show unset'
0 A% n5 B. G1 w6 A! ? cmds_flavor_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --id --ram --disk --ephemeral --swap --vcpus --rxtx-factor --public --private --property --project --description --project-domain'
' i$ g8 z ^' O# B/ W6 e cmds_flavor_delete='-h --help'
8 z5 m# x4 b8 D0 A cmds_flavor_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --public --private --all --long --marker --limit'# n: L) _& b- {; K5 v4 _2 ]0 F
cmds_flavor_set='-h --help --no-property --property --project --description --project-domain'
( w. E- L9 g2 n% Z8 `+ N/ n0 p9 g8 s5 e, l cmds_flavor_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
1 d- g3 G2 f+ }: Y4 I6 L# B9 M2 u cmds_flavor_unset='-h --help --property --project --project-domain'
. e3 k! G r% d# n. O cmds_floating='ip'# O0 E' Y. e3 e
cmds_floating_ip='create delete list pool port set show unset'
+ z* F) C. q% D# V9 }! [7 d cmds_floating_ip_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --subnet --port --floating-ip-address --fixed-ip-address --qos-policy --description --project --dns-domain --dns-name --project-domain --tag --no-tag'0 t) l7 @3 P2 H2 R8 W' F7 M
cmds_floating_ip_delete='-h --help'0 w$ N* z y) w9 M+ X
cmds_floating_ip_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --network --port --fixed-ip-address --floating-ip-address --long --status --project --project-domain --router --tags --any-tags --not-tags --not-any-tags'
- T4 \+ w( t h' j cmds_floating_ip_pool='list'6 a: I$ Y2 h* t/ e/ W' M
cmds_floating_ip_pool_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column'. Y. ~1 E# l% l* j/ g4 k, P
cmds_floating_ip_port='forwarding'
% R; s0 S! [" V% g- H+ t* y' H cmds_floating_ip_port_forwarding='create delete list set show'1 X0 C W- e3 m$ _& x3 q
cmds_floating_ip_port_forwarding_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --internal-ip-address --port --internal-protocol-port --external-protocol-port --protocol'" X+ Q) B2 \6 U" @; G/ D7 j
cmds_floating_ip_port_forwarding_delete='-h --help'9 ]2 {1 _; g3 ~! W0 @
cmds_floating_ip_port_forwarding_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --port --external-protocol-port --protocol'! H& K$ d1 |0 L
cmds_floating_ip_port_forwarding_set='-h --help --port --internal-ip-address --internal-protocol-port --external-protocol-port --protocol'
. U' c8 j3 P( {$ x cmds_floating_ip_port_forwarding_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
$ S& n4 [0 W) e7 m7 e0 r+ S9 v cmds_floating_ip_set='-h --help --port --fixed-ip-address --description --qos-policy --no-qos-policy --tag --no-tag' r( w- D/ ?$ k3 f2 x
cmds_floating_ip_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
0 @0 _4 Q. e$ u" Q cmds_floating_ip_unset='-h --help --port --qos-policy --tag --all-tag'
$ V1 r3 ~5 Q; ^; w: W* n5 n cmds_hypervisor='list show stats'1 g& v( S$ }/ q5 u' r6 q& r
cmds_hypervisor_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --matching --long'* l0 \) r2 E" E! }: c2 \
cmds_hypervisor_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'& F+ U) K3 ^8 | w5 b) W( O" o
cmds_hypervisor_stats='show'% e; |. D& u2 V( G# z
cmds_hypervisor_stats_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
' R# Y' a) l! d6 R# ^! e cmds_image='add create delete list member remove save set show unset'' y. P! K0 O. ?' L% Y/ s7 ]1 N
cmds_image_add='project'
7 l) \7 g' t* w cmds_image_add_project='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --project-domain'
# h7 l c3 U" c7 T- ] cmds_image_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --id --container-format --disk-format --min-disk --min-ram --file --volume --force --sign-key-path --sign-cert-id --protected --unprotected --public --private --community --shared --property --tag --project --project-domain --size --location --copy-from --checksum --store'
0 ]% p/ N* O; p0 @# i9 k. n cmds_image_delete='-h --help'/ D$ w% Q. U4 B0 w h. W
cmds_image_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --public --private --community --shared --property --name --status --member-status --tag --long --page-size --sort --limit --marker'+ q( \$ i O7 ^: w2 w( `# [
cmds_image_member='list'
/ e* W1 e2 `; G1 M" } cmds_image_member_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --project-domain'
o2 X" e, w! `: y5 Y cmds_image_remove='project'& R6 c3 G0 ]4 e9 N+ W- E
cmds_image_remove_project='-h --help --project-domain'$ R) R( u; e3 t) t. s! g
cmds_image_save='-h --help --file': A" u F/ Y4 Y S6 A
cmds_image_set='-h --help --name --min-disk --min-ram --container-format --disk-format --protected --unprotected --public --private --community --shared --property --tag --architecture --instance-id --instance-uuid --kernel-id --os-distro --os-version --ramdisk-id --deactivate --activate --project --project-domain --visibility --accept --reject --pending'
$ V- K8 l$ `3 F$ J ^. x: B cmds_image_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --human-readable'
_# h, g" w" ?4 ^+ E cmds_image_unset='-h --help --tag --property'
1 L' s+ J' \1 q cmds_server_delete='-h --help --wait'+ P% |8 Q2 \' n% \, M6 g+ H( y
cmds_server_dump='create'
! U2 O. N6 v7 y* b cmds_server_dump_create='-h --help'& A0 i' F2 o# r- n6 x/ v, ]
cmds_server_event='list show'4 d& r% Q+ E* N
cmds_server_event_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long'
. w2 h: F& m: U+ L4 i* t cmds_server_event_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix') x1 i- U* s% x
cmds_server_group='create delete list show'( a7 i' A- R1 K) I0 ]4 t, T/ O8 }
cmds_server_group_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --policy'
( L: Q8 i! M: \/ K9 E; A, u cmds_server_group_delete='-h --help'
& L. A2 v; l" O" b& C; j cmds_server_group_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --all-projects --long'
; F' o: L+ }$ g. C* j. r$ F cmds_server_group_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'# E, ~3 f: [4 i3 {, ?
cmds_server_image='create'
+ X% v6 u- b; m/ Y cmds_server_image_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --name --wait'
$ ~7 ]4 \3 W+ W( n) Z, S: w9 m' m4 g cmds_server_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --reservation-id --ip --ip6 --name --instance-name --status --flavor --image --host --all-projects --project --project-domain --user --user-domain --long -n --no-name-lookup --name-lookup-one-by-one --marker --limit --deleted --changes-before --changes-since --locked --unlocked'
7 A, S+ R, ]& k& `+ [4 t cmds_server_lock='-h --help --reason'
, n8 R& S \0 V$ | cmds_server_migrate='-h --help --live-migration --live --host --shared-migration --block-migration --disk-overcommit --no-disk-overcommit --wait' W0 n& r. [4 R c6 b K: A
cmds_server_pause='-h --help': `& p: T1 g0 P6 t
cmds_server_reboot='-h --help --hard --soft --wait'+ g; b* w+ _4 U' N2 w9 o4 H8 W m
cmds_server_rebuild='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --image --password --property --description --wait --key-name --key-unset'' r3 I' e; p d7 @( ^# q/ b
cmds_server_remove='fixed floating network port security volume'
" o: b: ]1 n G2 m cmds_server_remove_fixed='ip'6 J; A+ U9 Y3 ?2 j3 _; t
cmds_server_remove_fixed_ip='-h --help'7 s$ x+ E4 N# G) U; I) Q1 L4 D8 }
cmds_server_remove_floating='ip'
: K) D: \1 Z2 T cmds_server_remove_floating_ip='-h --help'
# u6 d% ]! T1 d( C" i/ ~* ~7 c# d& ~ cmds_server_remove_network='-h --help'/ D" ?# r3 W- p+ S* W7 e: x/ k
cmds_server_remove_port='-h --help'
9 C# S- G3 R& v cmds_server_remove_security='group'$ w6 G! z6 L6 Q H+ p9 r
cmds_server_remove_security_group='-h --help'
8 N' f5 B2 E+ t2 U" ?" w cmds_server_remove_volume='-h --help'4 z1 {) @. o& @. F# J
cmds_server_rescue='-h --help --image --password'7 T6 p/ D6 s6 o$ V4 x
cmds_server_resize='-h --help --flavor --confirm --revert --wait revert confirm'! Q5 o( s+ d5 J" r9 g
cmds_server_resize_confirm='-h --help'
2 i) L( T/ c2 O cmds_server_resize_revert='-h --help'
7 |! O3 h# B2 f9 y cmds_server_restore='-h --help'4 E# U7 w& H# h* P) C1 H0 E
cmds_server_resume='-h --help'
1 F) r6 Y, Y- `: r0 g! ~; Y5 h cmds_server_set='-h --help --name --root-password --property --state --description'
- N! ^, j7 p5 w4 P* n7 @, y cmds_server_shelve='-h --help'+ C+ A0 [% y" `* K0 l7 K, v
cmds_server_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --diagnostics'
9 H5 U( m, T8 m* q6 m cmds_server_ssh='-h --help --login -l --port -p --identity -i --option -o -4 -6 --public --private --address-type -v'* K, R( Q9 z* i5 |+ c1 y
cmds_server_start='-h --help'
6 R5 w- `* A( I2 I8 j, g% C! ]7 X cmds_server_stop='-h --help'% B0 m4 \( b* j) d3 X0 {: q
cmds_server_suspend='-h --help': d! Q: u. o( \! _/ ]' r
cmds_server_unlock='-h --help'
4 r8 O8 F ~9 Y+ s9 G& c) y cmds_server_unpause='-h --help'0 p0 P0 B' F/ {6 Z/ {( \
cmds_server_unrescue='-h --help'- }, g6 E' {2 v6 }3 o* Q7 R
cmds_server_unset='-h --help --property --description'
$ W8 R- v/ `) D0 }* b8 u2 B cmds_server_unshelve='-h --help --availability-zone'
- j# ` A! g' p+ r' N cmds_service='create delete list provider set show'$ G6 Z3 l* t/ E4 X: h
cmds_service_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --name --description --enable --disable'* @" X' F" ~" p$ h8 \
cmds_service_delete='-h --help'4 B3 X- s. Z4 i1 C, }6 I) {, v
cmds_service_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long'8 d1 F$ ]1 S9 x o, ?( K8 @! G
cmds_service_provider='create delete list set show'
0 c& w* y9 }8 W6 ~6 C' F6 a% p& g cmds_service_provider_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --auth-url --description --service-provider-url --enable --disable'
2 U4 ^' [0 O5 d3 b) T; l2 H cmds_service_provider_delete='-h --help'! r; { ^+ U7 n$ W! v2 f
cmds_service_provider_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column'8 c3 X, R9 _( ?) E5 [/ c
cmds_service_provider_set='-h --help --auth-url --description --service-provider-url --enable --disable'2 b/ t) ^" W$ u) A1 U
cmds_service_provider_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
+ A- n2 Q1 I6 h2 } cmds_service_set='-h --help --type --name --description --enable --disable'
5 s+ g$ y3 y+ _; C* G cmds_service_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
; G1 A1 \. Q& @* F cmds_sfc='flow port service'% `: Z/ _0 A1 ^ l* K
cmds_sfc_flow='classifier'
[& S0 n8 v% V9 h: @4 ` cmds_sfc_flow_classifier='create delete list set show'
. R4 U, q2 `! h- h, O V& g cmds_sfc_flow_classifier_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --description --protocol --ethertype --source-port --destination-port --source-ip-prefix --destination-ip-prefix --logical-source-port --logical-destination-port --l7-parameters'! Q4 ]1 l7 \# |, e+ [
cmds_sfc_flow_classifier_delete='-h --help'
2 ^0 M6 T5 z% ~; ~9 j cmds_sfc_flow_classifier_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long'
& N( z/ p- ^& u( M cmds_sfc_flow_classifier_set='-h --help --name --description'5 [! Z4 `6 \7 ^# s8 O7 U6 i7 u$ t
cmds_sfc_flow_classifier_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix', U1 B7 \/ t2 N. n9 h
cmds_sfc_port='chain pair'* h9 w' s7 p5 B- C- w) ^5 ]0 I
cmds_sfc_port_chain='create delete list set show unset'* _' T( n E& t6 k9 a
cmds_sfc_port_chain_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --description --flow-classifier --chain-parameters --port-pair-group'* u% A- |4 H! e" A: @, V/ I
cmds_sfc_port_chain_delete='-h --help'
7 V1 T+ O% h4 f. ^8 S' ~ cmds_sfc_port_chain_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long'6 |2 b! q, C4 _. t, o
cmds_sfc_port_chain_set='-h --help --name --description --flow-classifier --no-flow-classifier --port-pair-group --no-port-pair-group'$ y% d! k! Q% o& I9 P% g$ P! L
cmds_sfc_port_chain_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'& P$ [& ]! \& ?7 h
cmds_sfc_port_chain_unset='-h --help --flow-classifier --all-flow-classifier --port-pair-group'
# x/ [2 t7 H5 d cmds_sfc_port_pair='create delete group list set show'
/ B2 |" _, G5 B, u1 c2 C) H cmds_sfc_port_pair_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --description --service-function-parameters --ingress --egress'
K0 a+ w+ W8 ~; D cmds_sfc_port_pair_delete='-h --help' _5 y' e% y# v7 ~" }' h" R1 N; R
cmds_sfc_port_pair_group='create delete list set show unset'
' i, ?5 g [/ @$ {4 C. b cmds_sfc_port_pair_group_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --description --port-pair --enable-tap --disable-tap --port-pair-group-parameters'
& H+ j* [, ]- q: y9 O* I) d cmds_sfc_port_pair_group_delete='-h --help'7 F) A Q% z9 f/ V c2 v9 c
cmds_sfc_port_pair_group_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long' }- d. {! f% Z# k" f" W
cmds_sfc_port_pair_group_set='-h --help --name --description --port-pair --no-port-pair'; F% v) E C& r( x7 q, E2 f; j
cmds_sfc_port_pair_group_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
. ?* `5 O! c1 G, R# f cmds_sfc_port_pair_group_unset='-h --help --port-pair --all-port-pair'
8 z! X" Z7 f' n; V1 B0 M+ N: F1 ] cmds_sfc_port_pair_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long'6 v% r) ~, e6 I: `" w
cmds_sfc_port_pair_set='-h --help --name --description'% M0 I4 k3 p: u, g7 _/ m. q* F
cmds_sfc_port_pair_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'2 n A) n; P3 d% c( g0 i
cmds_sfc_service='graph'
1 g3 W- }! q+ b! P: C+ o( ]) I3 ^ cmds_sfc_service_graph='create delete list set show'
* m2 ?$ g' k5 X/ C) M" f5 p+ f* Z cmds_sfc_service_graph_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --description --branching-point'0 I9 S' P7 }" T$ ~7 z
cmds_sfc_service_graph_delete='-h --help'- W' w9 k8 E. z& F6 h- V
cmds_sfc_service_graph_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long'2 J& H R" `* C' @/ G
cmds_sfc_service_graph_set='-h --help --name --description'
/ _$ X" R- ^8 H4 A; ` cmds_sfc_service_graph_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'8 g$ U- \; K6 t0 W
cmds_subnet='create delete list pool set show unset'" @" L) Q9 W6 {# M4 U! ^
cmds_subnet_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --project --project-domain --subnet-pool --use-prefix-delegation --use-default-subnet-pool --prefix-length --subnet-range --dhcp --no-dhcp --dns-publish-fixed-ip --no-dns-publish-fixed-ip --gateway --ip-version --ipv6-ra-mode --ipv6-address-mode --network-segment --network --description --allocation-pool --dns-nameserver --host-route --service-type --tag --no-tag'7 b% g/ |) d4 M
cmds_subnet_delete='-h --help'2 D5 n9 M O! A1 Q) I
cmds_subnet_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long --ip-version --dhcp --no-dhcp --service-type --project --project-domain --network --gateway --name --subnet-range --tags --any-tags --not-tags --not-any-tags'
1 R2 {9 {' j/ u1 Q) k' ^ cmds_subnet_pool='create delete list set show unset'
5 J9 b6 e) K7 c" w cmds_subnet_pool_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --pool-prefix --default-prefix-length --min-prefix-length --max-prefix-length --project --project-domain --address-scope --default --no-default --share --no-share --description --default-quota --tag --no-tag'
' @, r0 z; N, |2 s cmds_subnet_pool_delete='-h --help'+ o# M" g9 k0 Z" e1 n; U
cmds_subnet_pool_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long --share --no-share --default --no-default --project --project-domain --name --address-scope --tags --any-tags --not-tags --not-any-tags'
+ |9 T% k8 x7 {2 b1 L cmds_subnet_pool_set='-h --help --name --pool-prefix --default-prefix-length --min-prefix-length --max-prefix-length --address-scope --no-address-scope --default --no-default --description --default-quota --tag --no-tag'
. ], q+ H/ M& m4 e: { cmds_subnet_pool_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'( w. Q3 q& v8 y9 P t9 y
cmds_subnet_pool_unset='-h --help --tag --all-tag'
; L: x1 G+ Z" ~4 f cmds_subnet_set='-h --help --name --dhcp --no-dhcp --dns-publish-fixed-ip --no-dns-publish-fixed-ip --gateway --network-segment --description --tag --no-tag --allocation-pool --no-allocation-pool --dns-nameserver --no-dns-nameservers --host-route --no-host-route --service-type') K, y. N% L; u
cmds_subnet_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'9 s. r) q$ T$ i P& }8 ^
cmds_subnet_unset='-h --help --allocation-pool --dns-nameserver --host-route --service-type --tag --all-tag'6 b% ?) \, z0 a9 o
cmds_volume='backup create delete host list migrate qos service set show snapshot transfer type unset'$ E) g; ^4 {. x& t/ v" M" ]
cmds_volume_backup='create delete list restore set show'
5 }0 o2 t o" I O1 q cmds_volume_backup_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --name --description --container --snapshot --force --incremental'
7 i! y. V/ `: |) \1 J cmds_volume_backup_delete='-h --help --force'( u) d# B6 v! G/ w3 ?" a
cmds_volume_backup_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long --name --status --volume --marker --limit --all-projects', Y( D$ q, l# z
cmds_volume_backup_restore='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
+ J* j G7 V! w& P. n: J cmds_volume_backup_set='-h --help --name --description --state'% q/ y5 N! F* u* ]+ Y- a
cmds_volume_backup_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'* n+ V. L6 D; C$ l6 I
cmds_volume_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --size --type --image --snapshot --source --source-replicated --description --availability-zone --consistency-group --property --hint --bootable --non-bootable --read-only --read-write'
1 ?# S0 d$ ?7 q$ X6 C cmds_volume_delete='-h --help --force --purge'- U o( w/ J6 [# H
cmds_volume_host='set'' ]4 h' n" v2 ]' Z& z) X1 t8 z9 c
cmds_volume_host_set='-h --help --disable --enable'
8 C0 R" P( J2 W cmds_volume_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --project --project-domain --user --user-domain --name --status --all-projects --long --marker --limit'
E# d7 n) n I8 n cmds_volume_migrate='-h --help --host --force-host-copy --lock-volume'
9 b" {$ Q* F" x- \1 Y6 G: D. l cmds_volume_qos='associate create delete disassociate list set show unset'
1 a0 Z* f3 H& I- p% s cmds_volume_qos_associate='-h --help'/ M5 G/ H ?8 O; Y, i
cmds_volume_qos_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --consumer --property'9 g# s6 k" Z, Y) \
cmds_volume_qos_delete='-h --help --force'+ f$ u# `+ V- F( b9 |( U' O
cmds_volume_qos_disassociate='-h --help --volume-type --all') ~! T8 {! u0 u5 ^% a& s4 ?) K V
cmds_volume_qos_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column'
6 S. m( `" U8 w p3 s cmds_volume_qos_set='-h --help --property'$ h% \' x4 `0 h5 o; P( h7 k, V
cmds_volume_qos_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'7 I3 N* m, V" A; r
cmds_volume_qos_unset='-h --help --property'& P; X# O) B- d) {
cmds_volume_service='list set'% F8 v( N& y* t( A0 p
cmds_volume_service_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --host --service --long'
% n$ l; T6 k) ~4 o# ]7 j7 Q; W cmds_volume_service_set='-h --help --enable --disable --disable-reason'# L* a: J( ~. I/ A1 F7 w
cmds_volume_set='-h --help --name --size --description --no-property --property --image-property --state --attached --detached --type --retype-policy --bootable --non-bootable --read-only --read-write'! ]0 a/ C% A8 f
cmds_volume_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'. @1 R8 K. N( w$ V5 X! Z0 p
cmds_volume_snapshot='create delete list set show unset'' N4 v3 i# d j$ s
cmds_volume_snapshot_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --volume --description --force --property --remote-source'. }! b9 D$ l+ |; M& U. b
cmds_volume_snapshot_delete='-h --help --force'
- \4 a8 `& W" x cmds_volume_snapshot_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --all-projects --project --project-domain --long --marker --limit --name --status --volume'; [6 W/ Q. x" j! y9 Z. u4 P, q
cmds_volume_snapshot_set='-h --help --name --description --no-property --property --state'
9 Z; z6 n# u8 M; _ cmds_volume_snapshot_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'/ ~' |8 {8 y* J. v3 N
cmds_volume_snapshot_unset='-h --help --property'
6 h0 G" [+ K/ M) z cmds_volume_transfer='request'7 |& b t3 ^0 p! g& E9 f
cmds_volume_transfer_request='accept create delete list show'
( ]/ Z2 M& I- c9 q& ]5 _$ s% b cmds_volume_transfer_request_accept='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --auth-key'
; Y8 ^4 D! ?2 x cmds_volume_transfer_request_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --name' Q" s; f- ~- I6 ~: k" n4 y
cmds_volume_transfer_request_delete='-h --help'
1 c. f1 W( U2 N* {4 i cmds_volume_transfer_request_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --all-projects'
3 y4 g. M6 l7 ^; f8 S! I* E cmds_volume_transfer_request_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
, G& {# H7 r* { cmds_volume_type='create delete list set show unset'1 `+ ~: j/ h/ z! Q; }
cmds_volume_type_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --description --public --private --property --project --encryption-provider --encryption-cipher --encryption-key-size --encryption-control-location --project-domain'" K! u/ u G; U9 Q0 {
cmds_volume_type_delete='-h --help'; z2 H8 ^3 d, l- m: {
cmds_volume_type_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long --default --public --private --encryption-type'
5 Z% T% r+ J% N8 S: c/ m" N# W% A cmds_volume_type_set='-h --help --name --description --property --project --project-domain --encryption-provider --encryption-cipher --encryption-key-size --encryption-control-location'- ]$ X1 G+ b2 O4 @0 v, H
cmds_volume_type_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --encryption-type'; @8 R' G3 N" ]( b/ g5 d% J* z
cmds_volume_type_unset='-h --help --property --project --project-domain --encryption-type'
; P" Z7 h( L* f cmds_volume_unset='-h --help --property --image-property'2 e9 T+ j% @* u% h+ X( N
dash=-7 j! |6 A# I- O6 N" S) }" i2 A/ T
underscore=_
$ D8 ~# Y, L' h6 a) | cmd=""' q/ w1 C$ a2 F* h- c+ G
words[0]=""
) R+ [6 S) l: m6 n; u completed="${cmds}"
; ?+ w5 m( @; Q* t. t for var in "${words[@]:1}"
; M4 w, G) K8 r; i5 Q5 Z3 t do
0 u: A& X9 O. J6 M5 Q# Q6 y+ G% y F$ G5 R if [[ ${var} == -* ]] ; then
! M ^9 ^9 H! k# q7 l$ Y break
! ^& r0 D, X9 Z/ L' u% D/ [; u fi/ p$ _( O2 U/ a P
if [ -z "${cmd}" ] ; then
2 K2 _0 M; s3 B7 a. ^ proposed="${var}"
7 [( R4 k- H/ Z" U! }# ~ else
+ n8 ~# Y; \0 ] proposed="${cmd}_${var}"' V+ r7 n# |( i$ C/ d- x0 b
fi
- h) f4 b/ ^ C7 \0 E" X local i="cmds_${proposed}"
& m. F {, _: \" t i=${i//$dash/$underscore}
" P0 C' u( u" m/ }, \: p local comp="${!i}"
8 n% |# }) ] Z6 z if [ -z "${comp}" ] ; then: }3 v( C' Q- |% ?% f, s
break2 r" U2 ^& {1 H, \/ U% ]. H
fi" W" a: H" T! g, i; k$ G6 E/ k
if [[ ${comp} == -* ]] ; then: Y: |+ J+ n5 [+ [% O4 J/ c
if [[ ${cur} != -* ]] ; then
+ ]3 ] b2 W8 o& ~& J- ?, ]$ b completed=""% p" [: o2 c/ b" m
break
& {0 L# `3 G5 u9 ~: Y& ]: |% e [ fi
7 |$ A z; F- S2 o0 W) d fi
1 e! G' |% x+ n' g cmd="${proposed}"
8 t2 g: ?1 y& o0 ~/ Y2 I completed="${comp}"* K" Q/ c! ~9 |9 {+ [* S) D9 k W( N
done
; R1 k' W, n" X, w/ { if [ -z "${completed}" ] ; then
3 b, n! h9 f9 w4 ~8 b0 v COMPREPLY=( $( compgen -f -- "$cur" ) $( compgen -d -- "$cur" ) )7 |! l: s! e5 v" H
else2 l* U. b2 c; b2 y0 T" G
COMPREPLY=( $(compgen -W "${completed}" -- ${cur}) )5 @/ R- O1 w. w+ q" O7 N
fi3 s& @( u! H: v5 C+ U5 h# K
return 0" H8 J! c; D; ~& n/ y
}$ ~* Q; e0 T9 J. H
complete -F _nova nova3 b( N' i. ~6 y- @( b! Z6 k6 z
3 N. t# t4 d3 B3 r( t1 h
/ p' P% f. {& z- l* n/ a8 T3 a0 S; s$ i: s! V# |; U
保存退出后:& S" l* }* @6 y6 H, L7 m
" Y& i% A# {' m$ a+ S, Q
echo "source /etc/bash_completion.d/nova.bash_completion" >>~/.bashrc ' v3 d* Q; F9 r. Z
- x7 R$ ]5 h3 n9 x9 o% |# }* @9 B: F& n# {% Y
然后加载bashrc的文件:( n$ y2 N4 u% d
[root@controller1 ~]# source ~/.bashrc
m0 Q" q# ~; p" ?9 B- N; ?6 _% _6 T
+ n( l. _1 w/ Z& t# N. l6 R$ c7 P
: `, v9 k; z" Z2 }& Y |
|