-
Notifications
You must be signed in to change notification settings - Fork 19
/
_paket
1519 lines (1284 loc) · 42.8 KB
/
_paket
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#compdef paket=paket.exe paket.exe
# Zsh completion script for Paket (https://github.com/fsprojects/Paket/).
#
# This script is based on the excellent git complection in zsh. Many thanks
# to its authors!
#
#
# INSTALLATION
#
# 1. Download the paket-completion.zsh file to a subdirectory of your home
# directory, preferably a directory with other function files.
# 2. Rename it to _paket.
# 3. Add the directory to your zsh fpath before running compinit.
#
# $ target="$HOME/.zsh-completions"
# $ mkdir "$target"
# $ curl --fail --location --proto-redir -all,https --output "$target/_paket" https://raw.githubusercontent.com/fsprojects/Paket/master/completion/paket-completion.zsh
#
# In your ~/.zshrc:
#
# fpath=($HOME/directory/where/_paket/resides $fpath)
#
#
# UPDATING AN EXISTING INSTALLATION
#
# Just repeat the download from above.
#
# Alternatively the completion script comes bundled with the
# paket-completion-update function that will download the current
# paket-completion.zsh to the same file as above, even if you changed its
# location after the initial download.
#
# Please note: The paket-completion-update function requires curl to be
# installed. paket-completion-update is *only available after your
# first paket completion* per shell session (i.e. after the Paket completion
# functions have been autoloaded by zsh).
#
# paket-completion-update supports an optional first parameter that allows you
# to override the default download root URL which is
# https://raw.githubusercontent.com/fsprojects/Paket/master/completion.
#
#
# PAKET ALIAS
#
# For easier consumption of Paket (without paket.sh or paket.cmd) it is advised
# to create an alias and always run Paket from the repository root.
#
# Also have a look at Paket's magic mode.
# https://fsprojects.github.io/Paket/bootstrapper.html#Magic-mode
#
# Somewhere in your ~/.zshrc:
#
# if [[ "$OS" != Windows* ]]; then
# alias paket='mono ./.paket/paket.exe'
# else
# alias paket='./.paket/paket.exe'
# fi
#
# Also ensure that zsh completes aliases based on the expanded alias contents.
# http://zsh.sourceforge.net/Doc/Release/Options.html#index-COMPLETEALIASES
#
# unsetopt completealiases
#
# If you don't like alias completion, define that the paket alias should be
# completed using the _paket function defined in this file.
#
# setopt completealiases
# compdef _paket paket
#
#
# MONO
#
# If you use Mono (e.g. on Linux or macOS) and do not have Mono completion
# installed, you need to define that mono invokes other programs:
#
# compdef _precommand mono
#
# This is similar to `nohup` invoking the "real" program that needs to be
# completed. More details: https://unix.stackexchange.com/a/178054/72946
#
# For an exemplar mono completion, have a look here:
# https://github.com/agross/dotfiles/tree/master/mono/functions/_mono
#
#
# CONFIGURATION
#
# You can configure some aspects of Paket completion. Add these to your
# ~/.zshrc.
#
# Define where to look for paket.exe
#
# Depending on what should be completed the Paket executable will be run by
# the completion script. The completion script searches for a local
# installation at ./.paket/paket.exe first. Local installs will be prepended
# with mono unless you are running Windows. Global installations will be
# looked at last (i.e. paket in the $PATH). They are not prepended with
# mono.
#
# To override the list of possible locations for local installations of
# paket.exe, define the following `paket-executable` style. The list of values
# will be searched as defined.
#
# # This is the default.
# zstyle ':completion::complete:paket:*' paket-executable './.paket/paket.exe'
# # Useful for Paket developers: Prefer the locally built version in bin over the one in .paket.
# zstyle ':completion::complete:paket:*' paket-executable './bin/paket.exe' './.paket/paket.exe'
#
#
# Enable infix matching for package IDs
#
# By default paket find-packages will match infixes, which is not the default
# mode for Paket completion. I think it's unnatural to type
# paket add FAK<tab>
# which will be completed to
# paket add Altairis.Fakturoid.Client
# if infix matching is enabled.
#
# If you want this behavior, enable infix matches:
#
# zstyle ':completion::complete:paket:*' infix-match yes
# zstyle ':completion::complete:paket:add:*' infix-match yes # Only for paket add.
#
#
# Disable fallback (i.e. default zsh) completion for Paket commands that do not
# have a completion function:
#
# zstyle ':completion::complete:paket:*' use-fallback no
#
#
# Disable verbose completion of main commands:
#
# zstyle ':completion::complete:paket:*' verbose no
#
#
# Define the zsh completion cache policy for expensive operations that generate
# completions.
#
# Paket will e.g. issue HTTP requests when you complete a package ID or a
# version number. These take time so we take advantage of the zsh
# completion cache and store such results.
#
# Enable the zsh completion cache globally, including completions for other
# commands that also leverage caching:
#
# zstyle ':completion:*' use-cache on
# zstyle ':completion:*' cache-path instead/of/$HOME/.zcompcache # Optional.
#
# To disable the cache for specific Paket commands to always get fresh
# results when completing e.g. paket add:
#
# zstyle ':completion::complete:paket:add:*' use-cache off
#
# The caches are stored under the cache-path as follows:
#
# <cache-path>/paket/<expensive command>/<parameter>
#
# e.g.
#
# <cache-path>/paket/find-packages/fak
#
# if you completed 'paket find-packages FAK' or 'paket find-packages fak'
# before.
#
# The default cache policy caches results for 1 day (see _paket_cache_policy).
# To remove cached results you can either delete the
# <cache-path>/paket directory or provide a custom cache policy to control
# cache expiration for all or specific Paket commands:
#
# zstyle ':completion::complete:paket:*' cache-policy _default_cache_policy
# zstyle ':completion::complete:paket:find-packages:*' cache-policy _strict_cache_policy
#
# _default_cache_policy () {
# # Rebuild if the cache is more than a week old.
# local file="$1"
# local -a outdated
# # See http://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Qualifiers
# outdated=( "$file"(Nm+7) )
# (( $#outdated ))
# }
#
# _strict_cache_policy () {
# return 0 # 0 == always outdated, you should better use use-cache off.
# }
#
# There are two special default cache policies for completions relying on the
# existence of local files, e.g. paket.dependencies or paket.lock.
# For Paket commands that read these, the cache is invalidated as soon as the
# file's modification time is newer than the cache.
# (See _paket_cache_policy_dependencies_file and
# _paket_cache_policy_lock_file.)
#
#
# Disable running Paket to get packages, versions etc. as completion arguments
#
# Disable globally:
#
# zstyle ':completion::complete:paket:*' disable-completion yes
#
# Disable only a single means to get completion values:
#
# # Used by e.g. paket add:
# zstyle ':completion::complete:paket:find-packages:' disable-completion yes
# zstyle ':completion::complete:paket:find-package-versions:' disable-completion yes
# zstyle ':completion::complete:paket:show-groups:' disable-completion yes
#
# # Used by e.g. paket why:
# zstyle ':completion::complete:paket:show-installed-packages:' disable-completion yes
#
#
# Custom feed URLs for --source and paket push --url argument
#
# Define additional sources that will be completed for all Paket commands:
#
# zstyle ':completion::complete:paket:*' sources 'http://one.example.com/feed/v2'
# zstyle ':completion::complete:paket:*' sources \
# 'http://one.example.com/feed/v2' \
# 'http://second.example.com/feed/v2'
#
# Override list for a specific command:
#
# zstyle ':completion::complete:paket:find-package-versions:*' sources \
# 'http://another.example.com/feed/v2'
# zstyle ':completion::complete:paket:push:*' sources \
# 'https://myget.org/F/my-feed-name'
_paket() {
local curcontext=$curcontext context state state_descr line ret=1
typeset -A opt_args
# Strip .exe extension.
curcontext="${curcontext%.*}:"
# Set up default cache policy.
local -A default_policies
default_policies[${curcontext}*]=_paket_cache_policy
default_policies[${curcontext}*:*:show-groups:]=_paket_cache_policy_dependencies_file
default_policies[${curcontext}*:*:show-installed-packages:]=_paket_cache_policy_lock_file
local key cache_policy
for key in "${(@kO)default_policies}"; do
local ctx="$key"
local policy="${default_policies[$key]}"
zstyle -s ":completion:$ctx" cache-policy cache_policy
if [[ -z "$cache_policy" ]]; then
zstyle ":completion:$ctx" cache-policy $policy
fi
done
# Do not offer anything after these options.
local -a terminating_options
terminating_options=(
'(- :)'--version'[show Paket version]'
)
# Currently not implemented:
# ! means that if these options were specified right after paket, do not
# offer them as completions for the command.
# E.g. paket --verbose install --<tab> won't show verbose again
local -a global_options
global_options=(
'(- :)'--help'[display help]'
'(--log-file)'--log-file'[print output to a file]:log file:_files'
'(-s --silent)'{-s,--silent}'[suppress console output]'
'(-v --verbose)'{-v,--verbose}'[print detailed information to the console]'
)
local -a keep_options
keep_options=(
'(--keep-major --keep-minor --keep-patch)'--keep-major'[only allow updates that preserve the major version]'
'(--keep-major --keep-minor --keep-patch)'--keep-minor'[only allow updates that preserve the minor version]'
'(--keep-major --keep-minor --keep-patch)'--keep-patch'[only allow updates that preserve the patch version]'
)
local -a binding_redirects_options
binding_redirects_options=(
'(--redirects)'--redirects'[create binding redirects]'
'(--clean-redirects)'--clean-redirects'[remove binding redirects that were not created by Paket]'
'(--create-new-binding-files)'--create-new-binding-files'[create binding redirect files if needed]'
)
local -a download_options
download_options=(
'(-f --force)'{-f,--force}'[force download and reinstallation of all dependencies]'
'(--touch-affected-refs)'--touch-affected-refs'[touch project files referencing affected dependencies to help incremental build tools detecting the change]'
)
# --verbose, --log-file and --silent (see above)
# These can appear as the first option, optionally followed by a command.
#
# --version and --help (see above)
# No more options are allowed afterwards.
#
# command
# Does not start with dash.
#
# option-or-argument
# This is the "rest" argument.
#
# For more information, see http://zsh.sourceforge.net/Doc/Release/Completion-System.html
# and search for "Each of the forms above may be preceded by a list in
# parentheses of option names and argument numbers".
_arguments -C \
$terminating_options \
$global_options \
'(-): :->command' \
'(-)*:: :->option-or-argument' \
&& ret=0
case "$state" in
(command)
_paket_commands && ret=0
;;
(option-or-argument)
# Construct :complete:paket:<command>:.
curcontext="${curcontext%:*}:${words[1]}:"
if ! _call_function ret "_paket-${words[1]}"; then
_message "Completion for Paket command '${words[1]}' is not implemented, please contact @agross"
if zstyle -T ":completion:$curcontext:" use-fallback; then
_default && ret=0
fi
fi
;;
esac
return ret
}
(( $+functions[_paket_group_option] )) ||
_paket_group_option() {
print -l '(--group -g)'{--group,-g}"[$1]:group:_paket_groups"
}
(( $+functions[_paket_source_url] )) ||
_paket_source_url() {
local state="$1" curcontext="${2%:*}" ret=1
case $state in
(source-url)
local -a user_sources
zstyle -a ":completion:$curcontext:" sources user_sources
local -a args
args=(
'source::_paket_sources'
'NuGet.org feed:NuGet.org feed:(https://www.nuget.org/api/v2 https://api.nuget.org/v3/index.json)'
"user-defined feed:user-defined feed:($user_sources)"
'urls::_urls'
)
_alternative \
$args \
&& ret=0
;;
esac
return ret
}
(( $+functions[_paket-add] )) ||
_paket-add() {
local curcontext=$curcontext context state state_descr ret=1
typeset -A opt_args
local -a line
local -a args
args=(
$global_options
$keep_options
$binding_redirects_options
$download_options
'(--interactive -i)'{--interactive,-i}"[ask for every project whether to add the dependency]"
'(--no-install)'--no-install'[do not modify projects]'
'(--no-resolve)'--no-resolve'[do not resolve]'
'(--project -p)'{--project,-p}'[add the dependency to a single project only]:project:_path_files -g "**/*.??proj"'
'(--type -t)'{--type,-t}"[type of the dependency (default: nuget)]:dependency type:((\
nuget\:'add NuGet dependency' \
clitool\:'add .NET Core CLI tool'))"
'(--version -V)'{--version,-V}'[dependency version constraint]: :->version'
"${(f)$(_paket_group_option 'add the dependency to a group (default: Main group)')}"
)
_arguments -C \
$args \
':NuGet package ID:->package-id' \
&& return
case $state in
(package-id)
_paket_packages && ret=0
;;
(version)
_paket_version_constraint && ret=0
;;
esac
return ret
}
(( $+functions[_paket-auto-restore] )) ||
_paket-auto-restore() {
local curcontext=$curcontext context state state_descr line ret=1
typeset -A opt_args
local -a args
args=(
$global_options
)
_arguments -C \
$args \
'1: :->mode' \
&& ret=0
case $state in
(mode)
local -a modes
modes=(
'on:enable automatic restore'
'off:disable automatic restore'
)
_describe -t modes mode modes \
&& ret=0
;;
esac
return ret
}
(( $+functions[_paket-clear-cache] )) ||
_paket-clear-cache() {
local curcontext=$curcontext context state state_descr line ret=1
typeset -A opt_args
local -a args
args=(
$global_options
'(--clear-local)'--clear-local"[also clear local packages and paket-files directory]"
)
_arguments -C \
$args \
&& ret=0
return ret
}
(( $+functions[_paket-config] )) ||
_paket-config() {
local curcontext=$curcontext context state state_descr line ret=1
typeset -A opt_args
local -a args
args=(
$global_options
)
_arguments -C \
$args \
': :->command' \
'*:: :->option-or-argument' \
&& ret=0
case $state in
(command)
local -a commands
commands=(
'add-credentials:add credentials for URL or credential key'
'add-token:add token for URL or credential key'
)
_describe -t commands command commands \
&& ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
(add-credentials)
_arguments -C \
$args \
'(--authtype)'--authtype'[authentication type (default: basic)]:authentication type:(basic ntlm)' \
'(--username)'--username'[provide username]:user name: ' \
'(--password)'--password'[provide password]:password: ' \
'(--verify)'--verify'[verify credentials]' \
'1: :->source-url-or-credential-key' \
&& ret=0
case $state in
(source-url-or-credential-key)
_alternative \
'source::_paket_sources' \
'credential key::_paket_credential_keys' \
'urls::_urls' \
&& ret=0
;;
esac
;;
(add-token)
_arguments -C \
$args \
'1: :->source-url-or-credential-key' \
'2:token' \
&& ret=0
case $state in
(source-url-or-credential-key)
_alternative \
'source::_paket_sources' \
'credential key::_paket_credential_keys' \
' :URL to set NuGet.org API key:(https://www.nuget.org)' \
'urls::_urls' \
&& ret=0
;;
esac
;;
esac
esac
return ret
}
(( $+functions[_paket-convert-from-nuget] )) ||
_paket-convert-from-nuget() {
local curcontext=$curcontext context state state_descr line ret=1
typeset -A opt_args
local -a args
args=(
$global_options
'(-f --force)'{-f,--force}'[force the conversion even if paket.dependencies or paket.references files are present]'
'(--no-install)'--no-install'[do not modify projects]'
'(--no-auto-restore)'--no-auto-restore"[do not enable automatic package restore]"
'(--migrate-credentials)'--migrate-credentials"[specify mode for NuGet source credential migration (default: encrypt)]:credential migration mode:((\
encrypt\:'store encrypted in paket.config (default)' \
plaintext\:'store as plain text in paket.dependencies' \
selective\:'be asked for every feed'))"
)
_arguments -C \
$args \
&& ret=0
return ret
}
(( $+functions[_paket-find-refs] )) ||
_paket-find-refs() {
local curcontext=$curcontext context state state_descr line ret=1
typeset -A opt_args
local -a args
args=(
$global_options
"${(f)$(_paket_group_option 'specify dependency group (default: Main group)')}"
)
_arguments -C \
$args \
'*: :->package-id' \
&& ret=0
case $state in
(package-id)
local group=${(v)opt_args[(i)--group|-g]:-Main}
_paket_installed_packages $group --all \
&& ret=0
;;
esac
return ret
}
(( $+functions[_paket-find-package-versions] )) ||
_paket-find-package-versions() {
local curcontext=$curcontext context state state_descr line ret=1
typeset -A opt_args
local -a args
args=(
$global_options
'(--source)'--source'[specify source URL]: :->source-url'
'(--max)'--max'[limit maximum number of results]:maxiumum results:(1 5 10 50 100 1000)'
)
_arguments -C \
$args \
':NuGet package ID:_paket_packages' \
&& ret=0
_paket_source_url "$state" "$curcontext" && ret=0
return ret
}
(( $+functions[_paket-find-packages] )) ||
_paket-find-packages() {
local curcontext=$curcontext context state state_descr line ret=1
typeset -A opt_args
local -a args
args=(
$global_options
'(--source)'--source'[specify source URL]: :->source-url'
'(--max)'--max'[limit maximum number of results]:maxiumum results:(1 5 10 50 100 1000)'
)
_arguments -C \
$args \
':NuGet package ID:_paket_packages' \
&& ret=0
_paket_source_url "$state" "$curcontext" && ret=0
return ret
}
(( $+functions[_paket-generate-load-scripts] )) ||
_paket-generate-load-scripts() {
local curcontext=$curcontext context state state_descr line ret=1
typeset -A opt_args
local -a args
args=(
$global_options
'*'{-f,--framework}'[framework identifier to generate scripts for]:framework: '
'*'{-t,--type}'[language to generate scripts for]: :->language'
'*'{-g,--group}'[group to generate scripts for (default: all groups)]: :->group'
)
_arguments -C \
$args \
&& ret=0
case $state in
(language)
local -a languages
languages=(${(v@Qs_:_)opt_args[(I)--type|-t]})
_paket_languages -F languages \
&& ret=0
;;
(group)
local -a groups
# Search --group and -g optargs for values (v), make array (@) and
# remove quotes (Q) and split by : (s_:_).
groups=(${(v@Qs_:_)opt_args[(I)--group|-g]})
_paket_groups -F groups \
&& ret=0
;;
esac
return ret
}
(( $+functions[_paket-init] )) ||
_paket-init() {
_arguments $global_options
}
(( $+functions[_paket-info] )) ||
_paket-info() {
local curcontext=$curcontext context state state_descr ret=1
typeset -A opt_args
local -a line
local -a args
args=(
$global_options
'(--paket-dependencies-dir)'--paket-dependencies-dir'[shows the absolute path of the directory containing paket.dependencies, if it exists]'
)
_arguments -C \
$args \
&& ret=0
return ret
}
(( $+functions[_paket-install] )) ||
_paket-install() {
local curcontext=$curcontext context state state_descr line ret=1
typeset -A opt_args
local -a args
args=(
$global_options
$keep_options
$binding_redirects_options
$download_options
'(--only-referenced)'--only-referenced'[only install dependencies listed in paket.references files, instead of all packages in paket.dependencies]'
'(--generate-load-scripts)'--generate-load-scripts'[generate F# and C# include scripts that reference installed packages in a interactive environment like F# Interactive or ScriptCS]'
'*--load-script-framework[framework identifier to generate scripts for]:framework: '
'*--load-script-type[language to generate scripts for]: :->language'
)
_arguments -C \
$args \
&& ret=0
case $state in
(language)
local -a languages
languages=(${(vQs_:_)opt_args[(i)--load-script-type]})
_paket_languages -F languages \
&& ret=0
;;
esac
return ret
}
(( $+functions[_paket-outdated] )) ||
_paket-outdated() {
local curcontext=$curcontext context state state_descr line ret=1
typeset -A opt_args
local -a args
args=(
$global_options
"${(f)$(_paket_group_option 'specify dependency group (default: all groups)')}"
'(-f --force)'{-f,--force}'[force download and reinstallation of all dependencies]'
'(--ignore-constraints)'--ignore-constraints'[ignore version constraints in the paket.dependencies file]'
'(--pre --include-prereleases)'{--pre,--include-prereleases}'[consider prerelease versions as updates]'
)
_arguments -C \
$args \
&& ret=0
return ret
}
(( $+functions[_paket-pack] )) ||
_paket-pack() {
local curcontext=$curcontext context state state_descr line ret=1
typeset -A opt_args
local -a args
args=(
$global_options
'(--build-config)'--build-config'[build configuration that should be packaged (default: Release)]:build configuration: '
'(--build-platform)'--build-platform'[build platform that should be packaged (default: check all known platform targets)]:build platform: '
'(--version)'--version'[version of the package]:version: '
'(--template)'--template'[pack a single paket.template file]:template:_path_files -g "**/paket.template"'
'*--exclude[exclude paket.template file by package ID]: :->template-id'
'*--specific-version[version number to use for package ID]: :->specific-version'
'(--release-notes)'--release-notes'[release notes]:release notes: '
'(--lock-dependencies)'--lock-dependencies'[use version constraints from paket.lock instead of paket.dependencies]'
'(--minimum-from-lock-file)'--minimum-from-lock-file'[use version constraints from paket.lock instead of paket.dependencies and add them as a minimum version; --lock-dependencies overrides this option]'
'(--pin-project-references)'--pin-project-references'[pin dependencies generated from project references to exact versions (=) instead of using minimum versions (>=); with --lock-dependencies project references will be pinned even if this option is not specified]'
'(--symbols)'--symbols'[create symbol and source packages in addition to library and content packages]'
'(--include-referenced-projects)'--include-referenced-projects'[include symbols and source from referenced projects]'
'(--project-url)'--project-url'[homepage URL for the package]:URL:_urls'
)
_arguments -C \
$args \
':output directory for .nupkg files:_directories' \
&& ret=0
case $state in
(template-id)
local -a ids
ids=(${(vQs_:_)opt_args[(i)--exclude]})
_paket_template_ids -F ids \
&& ret=0
;;
(specific-version)
_message 'TODO, not implemented' \
&& ret=0
;;
esac
return ret
}
(( $+functions[_paket-push] )) ||
_paket-push() {
local curcontext=$curcontext context state state_descr line ret=1
typeset -A opt_args
local -a args
args=(
$global_options
'(--url)'--url'[URL of the NuGet feed]: :->url'
'(--api-key)'--api-key'[API key for the URL (default: value of the NUGET_KEY environment variable)]:API key: '
'(--endpoint)'--endpoint'[API endpoint to push to (default: /api/v2/package))]:endpoint: '
)
_arguments -C \
$args \
'1:NuGet package:_path_files -g "(^packages/)#/*.nupkg"' \
&& ret=0
case $state in
(url)
local -a user_sources
zstyle -a ":completion:$curcontext:" sources user_sources
local -a args
args=(
'source::_paket_sources'
'NuGet.org feed:NuGet.org feed:(https://www.nuget.org/)'
"user-defined feed:user-defined feed:($user_sources)"
'urls::_urls'
)
_alternative \
$args \
&& ret=0
;;
esac
return ret
}
(( $+functions[_paket-remove] )) ||
_paket-remove() {
local curcontext=$curcontext context state state_descr ret=1
typeset -A opt_args
local -a line
local -a args
args=(
$global_options
'(-f --force)'{-f,--force}'[force download and reinstallation of all dependencies]'
'(--interactive -i)'{--interactive,-i}"[ask for every project whether to remove the dependency]"
'(--no-install)'--no-install'[do not modify projects]'
'(--project -p)'{--project,-p}'[remove the dependency from a single project only]:project:_path_files -g "**/*.??proj"'
"${(f)$(_paket_group_option 'remove the dependency from a group (default: Main group)')}"
)
_arguments -C \
$args \
':NuGet package ID:->package-id' \
&& return
case $state in
(package-id)
local group=${(v)opt_args[(i)--group|-g]}
_paket_installed_packages $group \
&& ret=0
;;
esac
return ret
}
(( $+functions[_paket-restore] )) ||
_paket-restore() {
local curcontext=$curcontext context state state_descr ret=1
typeset -A opt_args
local -a line
local -a args
args=(
$global_options
$download_options
'*--references-file[restore packages from a paket.references file]:paket.references:_path_files -g "**/*paket.references"'
'(--only-referenced)'--only-referenced'[only restore packages that are referenced by paket.references files]'
'(--project -p)'{--project,-p}'[restore dependencies of a single project]:project:_path_files -g "**/*.??proj"'
'(--target-framework)'--target-framework'[restore only for the specified target framework]:target framework: '
'(--ignore-checks --fail-on-checks)'--ignore-checks'[do not check if paket.dependencies and paket.lock are in sync]'
'(--ignore-checks --fail-on-checks)'--fail-on-checks'[abort if any checks fail]'
"${(f)$(_paket_group_option 'restore dependencies of a single group')}"
)
_arguments -C \
$args \
&& return
return ret
}
(( $+functions[_paket-restriction] )) ||
_paket-restriction() {
local curcontext=$curcontext context state state_descr ret=1
typeset -A opt_args
local -a line
_arguments -C \
$global_options \
'1:Paket formula representing a restriction' \
&& ret=0
return ret
}
(( $+functions[_paket-show-groups] )) ||
_paket-show-groups() {
_arguments $global_options
}
(( $+functions[_paket-show-installed-packages] )) ||
_paket-show-installed-packages() {
local curcontext=$curcontext context state state_descr line ret=1
typeset -A opt_args
local -a args
args=(
$global_options
'(-p --project)'{-p,--project}'[specify project to show dependencies for]:project:_path_files -g "**/*.??proj"'
'(-a --all)'--all'[include transitive dependencies]'
)
_arguments -C \
$args \
&& ret=0
return ret
}
(( $+functions[_paket-simplify] )) ||
_paket-simplify() {
local curcontext=$curcontext context state state_descr line ret=1
typeset -A opt_args
local -a args
args=(
$global_options
'(-i --interactive)'{-i,--interactive}'[confirm deletion of every transitive dependency]'
)
_arguments -C \
$args \
&& ret=0
return ret
}
(( $+functions[_paket-update] )) ||
_paket-update() {
local curcontext=$curcontext context state state_descr ret=1
typeset -A opt_args
local -a line
local -a args
args=(
$global_options
$keep_options
$binding_redirects_options
$download_options
'(--filter)'--filter'[treat the NuGet package ID as a regex to filter packages]'
'(--no-install)'--no-install'[do not modify projects]'
'(--version -V)'{--version,-V}'[dependency version constraint]: :->version'
"${(f)$(_paket_group_option 'specify dependency group to update (default: all groups)')}"
)
_arguments -C \
$args \
':NuGet package ID:->package-id' \
&& return
case $state in
(package-id)
local group=${(v)opt_args[(i)--group|-g]}
_paket_installed_packages $group \
&& ret=0
;;
(version)
_paket_version_constraint && ret=0
;;
esac
return ret
}
(( $+functions[_paket-why] )) ||
_paket-why() {
local curcontext=$curcontext context state state_descr line ret=1
typeset -A opt_args
local -a args
args=(
$global_options
'(--details)'--details'[display detailed information with all paths, versions and framework restrictions]'
"${(f)$(_paket_group_option 'specify dependency group (default: Main group)')}"
)
_arguments -C \