|
|
为了让nova 命令可以补全,因为有些时候,命令可能记不住,可以尝试使用此方法设置,当然自己开发的环境可能就自带:
, R$ {- ~. A( Z% x9 {6 ]切换到/etc/bash_completion.d目录下:6 v! U& m6 g" @( ?, i
* S5 W5 d4 i* i3 F5 {创建文件vim nova.bash_completion ; K0 B7 D* D0 L! B/ s0 ^
* E+ j5 E- k! u; }
5 O+ x" I% t2 P0 m9 O! Q9 a_nova()
5 g5 ^$ {$ e% Z9 k2 X9 N{* Z* X9 c& z$ p/ P8 u
local cur prev words( ^5 A+ d& `' \- f1 N& w
COMPREPLY=()
+ P$ V- ^4 w# Z! n: l _get_comp_words_by_ref -n : cur prev words9 {: f" T( T$ T' w. P: g
# Command data:
1 e# S3 P' ?9 p, v7 r 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'
. g; k0 N* \$ N: O cmds_flavor='create delete list set show unset'
& D: Y! Y1 R3 z" ]7 x7 q 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'& C( [: H/ K5 Z6 M ~- R/ w# U
cmds_flavor_delete='-h --help'5 @' ^( y+ B) P
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'
0 }+ N% ]# s* k/ T5 H; [1 k$ ^" b cmds_flavor_set='-h --help --no-property --property --project --description --project-domain'7 K3 k: f$ j- v' P4 a! d; Z
cmds_flavor_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
u+ P+ f6 I+ t2 R cmds_flavor_unset='-h --help --property --project --project-domain'* H( o! b4 s* D% D1 Q
cmds_floating='ip'3 A/ p+ J7 V/ I1 G9 Q
cmds_floating_ip='create delete list pool port set show unset'8 l3 R5 g# n c! n: [( I
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'( W, u, |7 P3 M
cmds_floating_ip_delete='-h --help'
# r$ G4 x4 _! S# p0 m- d6 E+ N; l 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' M: e4 y5 g3 X
cmds_floating_ip_pool='list'
, o7 M9 ?. ~8 } cmds_floating_ip_pool_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column'/ R0 S$ y4 ^: z5 Z0 Y
cmds_floating_ip_port='forwarding'
+ G9 x& ^/ X/ f. ~% H0 @" O8 i cmds_floating_ip_port_forwarding='create delete list set show'( O$ }" I `2 w5 Z5 F1 k2 l- X% G# R
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'* t5 X' U% W( Z; y/ h
cmds_floating_ip_port_forwarding_delete='-h --help'$ f7 X2 ^3 A/ Z4 x/ ~3 {: \* i3 L
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'
0 t" n0 ?' H8 R D" o$ g2 h9 n cmds_floating_ip_port_forwarding_set='-h --help --port --internal-ip-address --internal-protocol-port --external-protocol-port --protocol'! I) R$ v4 b& [+ |6 i# W
cmds_floating_ip_port_forwarding_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
( a3 `( N9 h: D cmds_floating_ip_set='-h --help --port --fixed-ip-address --description --qos-policy --no-qos-policy --tag --no-tag'
7 z1 z7 Y0 {3 S5 a& V( b cmds_floating_ip_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'9 ~4 F$ G9 l7 M- S; p* a- B. D
cmds_floating_ip_unset='-h --help --port --qos-policy --tag --all-tag'. T6 }. g0 f5 L! t1 n& q9 e
cmds_hypervisor='list show stats' _% B' c3 v0 o" s e; Z t
cmds_hypervisor_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --matching --long' u/ m) z' H" B6 ?* h
cmds_hypervisor_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
2 b1 Z# R& N* H7 x6 V# a cmds_hypervisor_stats='show'. R- B Y1 E1 [1 A( r4 b. k
cmds_hypervisor_stats_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
2 V+ S; m; W3 R; R9 u cmds_image='add create delete list member remove save set show unset'4 X7 p0 k) X( `8 A& o2 M( g
cmds_image_add='project'7 N" ]& Q" G& b
cmds_image_add_project='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --project-domain'
: ~( I" c) }4 M 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'7 w" j9 d l3 f3 Z0 @* b9 [
cmds_image_delete='-h --help'% R3 P9 M! m! H$ z( @5 [
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'
8 S% {1 u5 Z e; M9 B cmds_image_member='list'* r: S3 W U0 Q7 X9 g
cmds_image_member_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --project-domain'
0 c' E# ]4 t8 w9 ` cmds_image_remove='project'% B; F2 \- k+ r+ k$ S' W
cmds_image_remove_project='-h --help --project-domain'* {% `( T% V. v8 p6 O
cmds_image_save='-h --help --file'
6 J- M3 d9 S/ b7 a( m 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'% r1 ~; i: b4 b1 o! O
cmds_image_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --human-readable'
b P8 r5 m3 |0 D; t h8 h5 P4 u cmds_image_unset='-h --help --tag --property'& p; j1 C$ V5 `, x( ~
cmds_server_delete='-h --help --wait'
, `! ?6 P6 y4 U% ]$ p ~ cmds_server_dump='create'1 F; ^' I$ J5 y9 y. |
cmds_server_dump_create='-h --help'1 z# Y1 S" m1 x0 o( w. H3 B
cmds_server_event='list show'2 E& h5 D& T3 M! C
cmds_server_event_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long' g/ C2 {; [& L8 w5 Z
cmds_server_event_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
7 {( A7 u6 O# I. {) G- i, f- j cmds_server_group='create delete list show'
, G8 ^: o8 ?& U; s$ j cmds_server_group_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --policy'/ P ? c! `$ B1 _! z4 x3 U( n$ s
cmds_server_group_delete='-h --help'. O+ c: p) O7 D% f \
cmds_server_group_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --all-projects --long'
2 E1 r$ y* q ^) e& r cmds_server_group_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'% b- h1 e3 r+ B @% L, \
cmds_server_image='create'
" T$ A1 K1 G, o$ \ cmds_server_image_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --name --wait'2 H k1 Z$ h9 C1 s! X9 C$ W. A
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'" {' K% l! z! _6 z. r* E
cmds_server_lock='-h --help --reason'
8 R1 g) b- T6 @0 {' y cmds_server_migrate='-h --help --live-migration --live --host --shared-migration --block-migration --disk-overcommit --no-disk-overcommit --wait'
0 s8 ~( o* P3 _, m7 c% L* o cmds_server_pause='-h --help'# U: V2 O" k: W6 ~8 C* Q5 d
cmds_server_reboot='-h --help --hard --soft --wait'# k8 V; B4 S: } p, F2 ?
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') a( ]8 X- I( z* x; |% |3 J4 T+ {
cmds_server_remove='fixed floating network port security volume'
$ x% [+ o+ v0 t1 r$ {+ m4 ^ cmds_server_remove_fixed='ip'& Z6 h4 A/ S9 ^3 \) _0 M: @
cmds_server_remove_fixed_ip='-h --help'
& N% p p4 u, t* W. S0 _: T cmds_server_remove_floating='ip'5 O/ q6 w. @& Z8 y0 K# j: c
cmds_server_remove_floating_ip='-h --help'! ]+ @1 I* T9 S3 E" N0 b8 K9 \; l# X
cmds_server_remove_network='-h --help'9 L0 P& O0 k: F" _ C h8 n
cmds_server_remove_port='-h --help'1 q, K+ F r* w. _1 J
cmds_server_remove_security='group'
1 A1 {) h6 G' k- d: d cmds_server_remove_security_group='-h --help'
3 y( E- i% T5 V! |3 } cmds_server_remove_volume='-h --help'8 |+ o% A* S/ E. \' T# D5 M
cmds_server_rescue='-h --help --image --password'6 J# ]+ S% |8 s* I3 Y
cmds_server_resize='-h --help --flavor --confirm --revert --wait revert confirm'
7 q% T: n; s: {1 k( q cmds_server_resize_confirm='-h --help'
! g- k9 [8 d3 Q/ h cmds_server_resize_revert='-h --help'5 r G/ o3 x8 R8 t) l2 ^# j1 g6 G
cmds_server_restore='-h --help'
1 h1 b3 c7 _# ?6 H: W' ` cmds_server_resume='-h --help'8 c! R" w# J; c# H( f
cmds_server_set='-h --help --name --root-password --property --state --description') v5 D- ]! J) ^; m
cmds_server_shelve='-h --help'
% l* O) d. p) B: n+ u( W' {% q cmds_server_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --diagnostics'- e; Z* e6 V0 F# [- Z1 W# T
cmds_server_ssh='-h --help --login -l --port -p --identity -i --option -o -4 -6 --public --private --address-type -v'4 S+ P1 \$ v0 V+ w1 j
cmds_server_start='-h --help'( O/ t' ~$ b9 q/ g# B6 U
cmds_server_stop='-h --help'2 Y% K+ ]6 J) ^! E
cmds_server_suspend='-h --help'
) q" `/ M1 Z% ^* V! \, `" \8 f" G cmds_server_unlock='-h --help'8 _9 \1 S9 h* Z# [% [; F" n1 o6 Y' D: N
cmds_server_unpause='-h --help'
; G/ \: j7 R1 F: w; x- |. l cmds_server_unrescue='-h --help'
5 t# E. I3 J" z0 q0 t cmds_server_unset='-h --help --property --description'
! M5 K% G6 e9 _/ R9 t, M cmds_server_unshelve='-h --help --availability-zone'
, j# t# I; Z& v7 f7 S cmds_service='create delete list provider set show'
" ?! n' k5 }3 k' ~% G1 p cmds_service_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --name --description --enable --disable'
O/ @% c6 l2 R$ T5 T6 P cmds_service_delete='-h --help'
3 B9 v% V6 |: O cmds_service_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long'
9 Z4 b) I# }& i5 B1 K* S; _ cmds_service_provider='create delete list set show'
. L$ e& N; m" N5 P7 O6 @ 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'+ |" x( n# A2 {9 ^
cmds_service_provider_delete='-h --help'
) \" g ~" _4 C' Q( W r1 @! @& g e cmds_service_provider_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column'
' }- X5 n6 g0 H) X& ~ cmds_service_provider_set='-h --help --auth-url --description --service-provider-url --enable --disable'8 H# b2 j, c+ d
cmds_service_provider_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix', L7 E' {! ?, F) k- H0 |2 @- C
cmds_service_set='-h --help --type --name --description --enable --disable'6 z2 E, Z3 k& |) ?, T8 B) q& L/ ^+ Y
cmds_service_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
! v$ m; ~3 j+ Y7 o( i cmds_sfc='flow port service'
7 W* _& _: g1 \; T7 }6 N$ V cmds_sfc_flow='classifier'( {" U9 p3 a1 z1 K3 l
cmds_sfc_flow_classifier='create delete list set show'0 c5 [- _4 m0 x V+ t
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'
8 ~" J: Z* d4 M+ m5 [ cmds_sfc_flow_classifier_delete='-h --help'1 m- V M% d3 ]6 }5 h! K. h* l! J
cmds_sfc_flow_classifier_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long', Q8 g' z! p S: q
cmds_sfc_flow_classifier_set='-h --help --name --description'
* ?( v9 i+ S2 F% H0 B# r cmds_sfc_flow_classifier_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
3 ~) U% q/ e | x cmds_sfc_port='chain pair'
# b+ W P ?/ Q) ] s, g8 k1 ~$ s cmds_sfc_port_chain='create delete list set show unset'! x* f7 [8 P2 Y# c8 }; K# e* x
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'- T- [. A8 r- u* V. Q& a
cmds_sfc_port_chain_delete='-h --help'
( h. s0 h/ H: R. j1 e% K cmds_sfc_port_chain_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long'
5 U: m: |/ d% c% W' r* f- K7 F% d# e cmds_sfc_port_chain_set='-h --help --name --description --flow-classifier --no-flow-classifier --port-pair-group --no-port-pair-group'
1 u% x. _# G' T9 w: ` Z cmds_sfc_port_chain_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
( [& O6 z9 R" b5 E cmds_sfc_port_chain_unset='-h --help --flow-classifier --all-flow-classifier --port-pair-group'
" b) z$ u+ o( C7 d4 l cmds_sfc_port_pair='create delete group list set show'
9 y( E; r2 j& Z! p# ]8 p& I 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'( \2 o8 d# n" B7 H! H9 w
cmds_sfc_port_pair_delete='-h --help'3 p, f. x- i& O. \8 S4 ?
cmds_sfc_port_pair_group='create delete list set show unset'0 k/ f. Y v7 n4 s
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'
" F6 k5 D" `2 F) b" `+ j+ B" [ cmds_sfc_port_pair_group_delete='-h --help'- S7 @& P+ m) s
cmds_sfc_port_pair_group_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long'
5 F: N, t0 ]) B, I' b2 A( b& l cmds_sfc_port_pair_group_set='-h --help --name --description --port-pair --no-port-pair'& U* S& m7 N) |6 O2 Y9 y0 E
cmds_sfc_port_pair_group_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
5 Z& q3 N2 ]4 ]6 M: Q& E1 ~: {4 p, k cmds_sfc_port_pair_group_unset='-h --help --port-pair --all-port-pair'* x" }. }2 u' ~
cmds_sfc_port_pair_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long': I; I" `9 @( \& ^3 D# j
cmds_sfc_port_pair_set='-h --help --name --description'
+ e* p% m9 z0 I% L cmds_sfc_port_pair_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'% X7 h' s# l2 [9 t* D
cmds_sfc_service='graph'
& S. L% c+ y) @: ` cmds_sfc_service_graph='create delete list set show'
X0 ^' p; ~) B" k cmds_sfc_service_graph_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --description --branching-point'4 U) H- |3 `& G2 @
cmds_sfc_service_graph_delete='-h --help') g3 F- A* Y$ r/ w, R
cmds_sfc_service_graph_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --long'
1 X% F( T) X* j, K cmds_sfc_service_graph_set='-h --help --name --description'
* J# a, i' ?' ?. ? cmds_sfc_service_graph_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'8 u+ C/ C& x' {& a7 Z( r
cmds_subnet='create delete list pool set show unset'# {1 u* }% @( K( D3 N6 d5 K
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'
! J. Z+ ?, r& h+ \4 S' ^ cmds_subnet_delete='-h --help'
$ B% w( n9 r8 B( s( R 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'
( ]" Y0 L! @4 Y1 T: j cmds_subnet_pool='create delete list set show unset'
9 w9 o& ~( b1 U) n9 C( s9 ` 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'
+ C- s7 t" k5 z$ t, ^5 E cmds_subnet_pool_delete='-h --help'# D% q, ~: s) Y6 F
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'5 V3 s2 Z6 I5 B6 }: O+ X2 Y4 D
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'
3 G$ G. u0 S$ U9 Q& ~: } cmds_subnet_pool_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'4 T: L, q0 e0 k! P$ B1 |
cmds_subnet_pool_unset='-h --help --tag --all-tag', O4 c! t1 A2 ?
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': S; a& ^' u, f/ ]$ { t
cmds_subnet_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
6 S' u- Q" Y" j1 @' X! s+ S cmds_subnet_unset='-h --help --allocation-pool --dns-nameserver --host-route --service-type --tag --all-tag'
, S" a, X3 x* E% G0 p1 e cmds_volume='backup create delete host list migrate qos service set show snapshot transfer type unset'
_- e: u' k3 t0 n4 x( @: [ cmds_volume_backup='create delete list restore set show'
$ ^9 L. c4 Z1 \4 y 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'! ?+ D% Y' S0 M% z
cmds_volume_backup_delete='-h --help --force'
& {7 l* o, c; n+ 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'
" `) v8 I+ M+ q cmds_volume_backup_restore='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
- j p4 w5 ]2 V5 R1 t; N, L cmds_volume_backup_set='-h --help --name --description --state'" S" H) s* O6 D$ `
cmds_volume_backup_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
2 f0 R# y) O) q- R& {6 L 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'
0 i6 g- K& X: I) ]1 G* R cmds_volume_delete='-h --help --force --purge': }( H3 ?6 Y( _7 v# F
cmds_volume_host='set'
( [# y D7 \) I. G. y9 F* b cmds_volume_host_set='-h --help --disable --enable'9 s7 M' @! y# ^* J2 j3 P+ Q6 Z# \+ e8 M
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'
# M( E3 k6 `6 w+ o7 m+ ? cmds_volume_migrate='-h --help --host --force-host-copy --lock-volume'
, v0 ^) C+ V' E, l cmds_volume_qos='associate create delete disassociate list set show unset'
& ?% i& F- `0 I; c cmds_volume_qos_associate='-h --help'
5 A+ z9 |# _( c cmds_volume_qos_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --consumer --property'
4 X6 c. V$ g( N3 V cmds_volume_qos_delete='-h --help --force'' y7 f! \9 z2 o; l) n
cmds_volume_qos_disassociate='-h --help --volume-type --all'5 D# ]( G# R h8 { b7 `/ v! e5 ~+ s0 o# Z
cmds_volume_qos_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column'0 D8 A* R' v4 s d2 \
cmds_volume_qos_set='-h --help --property'
! F/ `# v; |6 ] cmds_volume_qos_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'% a8 n$ l0 V$ b: A9 P a9 n" _' F
cmds_volume_qos_unset='-h --help --property'
0 u9 O# g/ Y0 Z$ h' H cmds_volume_service='list set'( x9 ^1 v/ ?& k! d8 S
cmds_volume_service_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --host --service --long'
. @3 r3 k9 k+ L7 t; t, a) r, M0 m7 e cmds_volume_service_set='-h --help --enable --disable --disable-reason'
: D O9 V# A0 V6 |, F$ P$ |! g 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'
7 R# w" r6 @; j6 |/ e, z3 e! o4 u cmds_volume_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
0 U9 y5 e- x5 J2 x! a cmds_volume_snapshot='create delete list set show unset'6 q5 Y% G8 G$ `
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'
$ Q3 ]4 z- P- W8 N: ]5 H& K cmds_volume_snapshot_delete='-h --help --force'
! k5 O4 w2 D1 X8 a, {$ m 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'. j) w7 F6 g, V9 L
cmds_volume_snapshot_set='-h --help --name --description --no-property --property --state'2 i& R% O& D, v7 ^/ C* c8 U4 Z
cmds_volume_snapshot_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
8 z9 d! ~4 v# P9 Z6 @( f& z cmds_volume_snapshot_unset='-h --help --property'# A& Y) }/ m* N* g& S
cmds_volume_transfer='request'
. F A2 W1 i) m/ U+ ? cmds_volume_transfer_request='accept create delete list show'
; n: h+ k; B* `+ y cmds_volume_transfer_request_accept='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --auth-key', L4 y; h+ h; ]* x6 W" s6 h* z: @
cmds_volume_transfer_request_create='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --name'- I6 E+ O* j9 g
cmds_volume_transfer_request_delete='-h --help'
2 I$ Z+ P1 h$ r5 D! F8 S cmds_volume_transfer_request_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --quote --sort-column --all-projects'! }( U E; p# Y
cmds_volume_transfer_request_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
: E X2 b6 ~/ { cmds_volume_type='create delete list set show unset'
' I+ s3 B0 w& H/ T! ^ 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'( |% o* @" a9 ^. {
cmds_volume_type_delete='-h --help'
/ \4 |$ h, S0 T6 r" h* C 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'
# v2 l3 L% [' N7 C cmds_volume_type_set='-h --help --name --description --property --project --project-domain --encryption-provider --encryption-cipher --encryption-key-size --encryption-control-location'
0 [& ]% O3 ]9 ]/ F: v cmds_volume_type_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --encryption-type'
* q( Z/ u! v- |$ P8 O cmds_volume_type_unset='-h --help --property --project --project-domain --encryption-type'
- g5 o) t) E% P8 }4 q/ d1 y/ L cmds_volume_unset='-h --help --property --image-property'5 T/ f$ `, e T) u9 \0 c
dash=-" g0 b' z- m/ c1 f
underscore=_
- |6 R% t& x; @8 | cmd="") y" q/ l5 K2 a5 q" r
words[0]=""- L. _6 x- Y4 e/ s& D3 |8 p8 ?
completed="${cmds}") ]! Z* Y8 |5 h. |
for var in "${words[@]:1}") G- p5 L2 `0 c5 a
do; v5 p. W: `) R- g1 H$ K; {
if [[ ${var} == -* ]] ; then
7 M' z) j/ K; K break' I& ~" O( A- ]
fi/ ~0 m% ]/ ^* T5 V
if [ -z "${cmd}" ] ; then1 Q5 ]8 p+ Z0 H, }9 l1 O! P
proposed="${var}"% f6 t; T/ m3 q+ R+ w; i
else
3 x9 k6 K0 g, o7 A D proposed="${cmd}_${var}"
. ]$ } A. H4 d F+ }, s fi
+ C Z8 I; @6 T+ H' O local i="cmds_${proposed}"# u7 M% u* F+ u2 w& Z4 b! A- E
i=${i//$dash/$underscore}2 X5 a7 f: K. U: E/ ~4 Q) I
local comp="${!i}"" a2 n2 O6 ? |; y! O! g0 H( l: [
if [ -z "${comp}" ] ; then
, R$ M9 ^* V# V; f0 @ break) C( m& j( n. f
fi. M7 E, O- h7 U N+ M$ O! H
if [[ ${comp} == -* ]] ; then' ]' J+ O {" Y- _
if [[ ${cur} != -* ]] ; then
) b4 v/ X5 f8 H* A completed=""1 L/ S, {: t2 q7 H- ]! s) S- J/ M+ E. v
break
$ [2 l3 r$ F Q- z. g4 P* Y9 R fi
0 M( h; n# g' I% A* l8 p, L4 k, M fi, E4 h! p y- J/ M
cmd="${proposed}"
( Z- O$ q( C$ I i completed="${comp}"
8 E: b4 Y1 g5 r+ h3 s- c( e done
! [: S. b5 j/ U, B& w) H0 z: s if [ -z "${completed}" ] ; then
* o% T) r1 `$ D3 W) k COMPREPLY=( $( compgen -f -- "$cur" ) $( compgen -d -- "$cur" ) )
. o2 B( o; H; P* E0 ?% E else! X* I. i1 N' j! d6 l7 l. O7 g6 J
COMPREPLY=( $(compgen -W "${completed}" -- ${cur}) )
1 ~- M( Y T! E- s) i2 V7 W1 p fi
8 ^& h x- D) C3 x: v% C return 0& s8 a% P9 n4 J" x
}- n# L4 ^+ g% T# I% C
complete -F _nova nova
, X! s0 f4 V$ j7 I1 C( C* @5 W) s5 W! B+ S1 W
2 k' \% X- |$ s3 i; H9 N
- n0 y* S" o D5 _1 o# z保存退出后:( N' w; `5 A. |% H8 Z
- y1 I- v, z P* _% P
echo "source /etc/bash_completion.d/nova.bash_completion" >>~/.bashrc ; u' z8 b; ]; Z" T, q
- Z( X$ z" v& B1 h" h, h0 k( w' s# K) j
然后加载bashrc的文件:
, ]6 K0 y- l7 y[root@controller1 ~]# source ~/.bashrc
2 P2 I% f4 {% p. F: t4 w; t( R6 s$ _9 X+ z# a; a
+ x) d, c8 M n; V, N% y6 v |
|