-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathMain.cls
More file actions
4114 lines (3776 loc) · 180 KB
/
Main.cls
File metadata and controls
4114 lines (3776 loc) · 180 KB
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
Include (%syGluedef, %sySecurity, %syPrompt, %IPM.Common, %IPM.Formatting)
IncludeGenerator %IPM.Common
Class %IPM.Main Extends %IPM.CLI
{
Parameter DOMAIN = "ZPM";
Parameter STANDARDPHASES = {$listbuild("reload","compile","test","package","verify","publish","makedeployed","applyupdatesteps")};
/// Description of commands to use for this CLI
XData Commands [ XMLNamespace = "http://www.intersystems.com/PackageManager/CLI" ]
{
<?xml version="1.0"?>
<commands>
<command name="help" aliases="?">
<description>Displays help information for the shell or a particular command.</description>
<!-- Parameters -->
<parameter name="command" description="Command for which help information should be displayed" />
<!-- Modifiers -->
<modifier name="verbose" aliases="v" description="Show full detail" />
<modifier name="markdown" aliases="m" description="Print detail in markdown format (for easy transfer to external documentation)" />
</command>
<command name="quit" aliases="q,exit">
<description>Exits the package manager shell.</description>
</command>
<command name="module-action" default="true" dataPrefix="D" trailingModifiers="true">
<summary>Performs operations on modules - compiling, running tests, packaging/registering, etc.</summary>
<description>
Performs operations on modules - compiling, running tests, packaging/registering, etc.
You can use this by starting a command with the module name.
Note that flags appear *after* all actions.
The standard lifecycle phases are:
* clean: removes all dependencies that are not required by other installed modules and
their resources. Dependencies required by other modules will also be removed if the -DClean.Force=1 flag is specified.
* reload: pulls module source code into the namespace from disk. Does not compile.
* validate: ensures that module resource processor attributes are valid, and that the
resources exported to the filesystem (and possible to source control) are consistent
with what is in the database.
* compile: compiles all resources within the module.
* activate: performs post-compilation installation/configuration steps.
* makedeployed: deploys resources within the module for which deployment is enabled.
* document: regenerates the API documentation for the module
* test: runs any unit tests associated with the module, in the current namespace.
* package: exports the module's resources and bundles them into a module artifact (.tgz file).
* verify: installs that artifact in a separate namespace, then runs integration tests (if any).
* register: saves that artifact into the current namespace's module cache.
This is accessible to other instances configured to look at the current namespace as a
module repository.
* publish: saves that artifact to the repository for which deployment is enabled.
Currently, there may only be one of these per namespace.
* applyupdatesteps: run any update steps for the module to become updated to the latest available version.
Can also specify desired version to update to.
</description>
<!-- Examples -->
<example description="Compiles the module named "MyModuleName"">module-action MyModuleName compile</example>
<example description="Performs multiple actions on the module named "MyModuleName"; "clean" deletes all of its dependenices, and "install" will then re-download them, package the module, and register it in the current namespace's module cache.">MyModuleName clean register</example>
<example description="Compiles the module named MyUIModule with verbose output and pParams("UIFW","force") (passed to all lifecycle phases) set to 42.">MyUIModule compile -v -DUIFW.force=42</example>
<example description="Verify the module MyModule with the env file /path/to/env.json. The module is responsible for accessing the data using %IPM.General.EnvironmentConfig:GetArg()">MyModule verify -env /path/to/env.json</example>
<!-- Parameters -->
<parameter name="module" required="true" description="Name of module on which to perform lifecycle actions" />
<parameter name="actions" required="true" description="Space-delimited list of module lifecycle phases to run" trailing="true" />
<!-- Modifiers -->
<modifier name="env" aliases="e" dataAlias="EnvFiles" value="true" description="Semicolon separated paths to the environment files in json format. See wiki for details." />
<modifier name="only" aliases="o" description="Only runs the specified phase(s), rather than also running predecessors." />
<modifier name="dev" dataAlias="DeveloperMode" dataValue="1" description="Sets the DeveloperMode flag for the module's lifecycle. Key consequences of this are that ^Sources will be configured for resources in the module, and installer methods will be called with the dev mode flag set." />
<modifier name="quiet" aliases="q" dataAlias="Verbose" dataValue="0" description="Produces minimal output from the command." />
<modifier name="verbose" aliases="v" dataAlias="Verbose" dataValue="1" description="Produces verbose output from the command." />
<modifier name="export-deps" value="true" valueList="0,1" dataAlias="ExportDependencies" description="If specified, controls whether dependencies are exported. If omitted, defaults to the value of the #EXPORTDEPENDENCIES in lifecycle class. This modifier is only used in "Package" and "Publish" lifecycles." />
</command>
<command name="init" aliases="initialize">
<summary>Configures the current namespace for package manager use.</summary>
<description>
Configures new namespace for use of package manager (interactive). This sets up the
local cache and allows for configuration of studio extensions for source control and
the package manager itself. In the case of Perforce-based source control, prompts are
included for username, password, Perforce workspace, and a few other settings.
</description>
<!-- Modifiers -->
<modifier name="noprompt" aliases="quiet,q" description="If specified, no prompts will be shown." />
<modifier name="zpm" aliases="cli" description="If specified, the zpm command will be configured." />
<modifier name="extension" aliases="ext" value="true" description="Generic extension (e.g., extension class for source control) to configure for the current namespace " />
<modifier name="menuextension" aliases="menuext" value="true" description="Server menu extension (Package Manager extension for server menus such as Studio, vscode menu, etc.) to configure for the current namespace" />
</command>
<command name="reload">
<description>
This command is an alias for `module-action module-name reload`
</description>
<parameter name="module" required="true" description="Name of module on which to perform reload action" />
</command>
<command name="compile">
<description>
This command is an alias for `module-action module-name compile`
</description>
<parameter name="module" required="true" description="Name of module on which to perform compile action" />
</command>
<command name="test" dataPrefix="D">
<description>
This command is an alias for `module-action module-name test`
</description>
<parameter name="module" required="true" description="Name of module on which to perform test action" />
</command>
<command name="package" dataPrefix="D">
<description>
This command is an alias for `module-action module-name package`
</description>
<parameter name="module" required="true" description="Name of module on which to perform package actions" />
<modifier name="path" aliases="p" dataAlias="Path" value="true" description="the specified path to export package." />
<modifier name="export-deps" value="true" valueList="0,1" dataAlias="ExportDependencies" description="If specified, controls whether dependencies are exported. If omitted, defaults to the value of the #EXPORTDEPENDENCIES in lifecycle class. This modifier is only used in "Package" and "Publish" lifecycles." />
<modifier name="export-python-deps" dataAlias="ExportPythonDependencies" dataValue="1" description="If specified, exports Python dependencies. If omitted, defaults to false." />
</command>
<command name="verify" dataPrefix="D">
<description>
This command is an alias for `module-action module-name verify`
</description>
<parameter name="module" required="true" description="Name of module on which to perform verify action" />
</command>
<command name="publish" dataPrefix="D">
<description>
This command is an alias for `module-action module-name publish`
</description>
<parameter name="module" required="true" description="Name of module on which to perform publish actions" />
<modifier name="repo" aliases="r" dataAlias="PublishTo" description="Namespace-unique name of repository for the module to publish to (if deployment is enabled)" />
<modifier name="use-external-name" aliases="use-ext" dataAlias="UseExternalName" dataValue="1" description="Publish the package under the <ExternalName> of the package. If ExternalName is unspecified or illegal, an error will be thrown."/>
</command>
<command name="update" dataPrefix="D">
<summary>Updates a module to a newer version.</summary>
<description>
Updates a module to a newer version. By default, updates to the latest available version. Also runs all of the update steps from the current version to the newer version.
This command is an alias for module-action module-name applyupdatesteps.
</description>
<!-- Examples -->
<example description="Updates the HS.JSON module from the current version to version 3.0.0.">
update HS.JSON 3.0.0
</example>
<!-- Parameters -->
<parameter name="module" required="true" description="Name of module on which to perform update actions" />
<parameter name="version" description="Version (or version expression) of module to update; defaults to the latest available if unspecified. Is ignored if -path is provided." />
<!-- Modifiers -->
<modifier name="verbose" aliases="v" dataAlias="Verbose" dataValue="1" description="Produces verbose output from the command." />
<modifier name="env" aliases="e" dataAlias="EnvFiles" value="true" description="Semicolon separated paths to the environment files in json format." />
<modifier name="path" aliases="p" value="true" description="Location of local tarball containing the updated version of the module. Overrides 'version' parameter if present." />
<modifier name="dev" dataAlias="DeveloperMode" dataValue="1" description="Sets the DeveloperMode flag for the module's lifecycle. Key consequences of this are that ^Sources will be configured for resources in the module, and installer methods will be called with the dev mode flag set." />
<modifier name="create-lockfile" aliases="lock" dataAlias="CreateLockFile" dataValue="1" description="Upon update, creates/updates the module's lock file." />
</command>
<command name="makedeployed">
<description>
This command is an alias for `module-action module-name makedeployed`
</description>
<parameter name="module" required="true" description="Name of module on which to perform reload action" />
<modifier name="recurse" aliases="r" description="Runs the specified phase (makedeployed) on the module and all of its dependencies." />
</command>
<command name="unpublish">
<description>
Delete package from repository
</description>
<example description="Delete all versions of the package "MyModuleName" from the repository">unpublish MyModuleName all</example>
<example description="Delete version "1.0.0" of the package "MyModuleName" from the repository named MyRepo">unpublish MyRepo/MyModuleName 1.0.0</example>
<parameter name="module" required="true" description="Name of module on which to perform unpublish actions" />
<parameter name="version" required="true" description="Version of module on which to perform unpublish actions. Use "all" to delete all versions of the package" />
<modifier name="force" aliases="f" value="false" description="Will delete module from the repository without prompting user for confirmation. Still requires authorization from the repository" />
<modifier name="quiet" aliases="q" dataAlias="Verbose" dataValue="0" description="Produces minimal output from the command." />
<modifier name="verbose" aliases="v" dataAlias="Verbose" dataValue="1" description="Produces verbose output from the command." />
</command>
<command name="config">
<description>Update ZPM settings. Setting is a key-value pair.</description>
<example description="Disable collecting analytics data">config set analytics 0</example>
<example description="Enable collecting analytics data">config set analytics 1</example>
<example description="list all settings">config list</example>
<example description="get value for analytics key">config get analytics</example>
<example description="reset to default value for analytics key">config delete analytics</example>
<parameter name="action" required="true" description="One of settings actions: list, get, set, delete" />
<parameter name="key" required="false" description="Setting key" />
<parameter name="value" required="false" description="Setting value" />
</command>
<command name="repo" aliases="repository" dataPrefix="D">
<summary>Configures the current namespace to search for modules in a repository.</summary>
<description>
Configures the current namespace to search for modules on a remote server or on the
local filesystem.
</description>
<!-- Examples -->
<example description="List all repositories">
repo -list
</example>
<example description="Delete all repositories">
repo -delete-all
</example>
<example description="Delete the repository named "LocalFiles"">
repo -n LocalFiles -delete
</example>
<example description="Lists all modules (and versions) available from the repository named "AppModules"">
repo -n AppModules -list-modules
</example>
<example description="Enables package manager web services in this namespace via the /csp/mynamespace/ web application, including web services for publishing. Note that security (e.g., authentication settings, required role) should be configured separately as part of this web application.">
repo -enable -app /csp/mynamespace -publish 1
</example>
<!-- Modifiers -->
<!-- Universal Actions -->
<modifier name="delete-all" description="Deletes all repositories (possibly subject to a type filter: e.g -filesystem, -remote, -local)" />
<modifier name="list" description="Lists all repositories (possibly subject to a type filter: e.g. -filesystem, -remote, -local)" />
<modifier name="list-modules" aliases="modules,listmodules" description="List modules available in the specified repository (-n\[ame]), or in all configured repositories if no repository was specified." />
<modifier name="info" description="Shows configuration details for the current namespace as a remote repository." />
<modifier name="copy-from" value="true" description="Copies repository configuration from a different (specified) namespace" />
<!-- General/shared modifiers -->
<modifier name="name" aliases="n" value="true" description="Namespace-unique name for the module" />
<modifier name="delete" description="Deletes the current namespace's reference to the named repository" />
<modifier name="publish" value="true" valueList="0,1" description="When configuring a remote repository, specifies that publishing of packages to the repository is allowed. When configuring the current namespace with -enable, specifies that publishing is also enabled. "/>
<!-- General properties -->
<modifier name="enable" value="false" description="For any repository, specifies that it can be used." />
<modifier name="disable" value="false" description="For any repository, specifies that it can not be used." />
<modifier name="snapshots" aliases="s" value="true" valueList="0,1" description="For any repository, specifies that it should be used to look for snapshot builds (i.e., those with a semantic version ending in '+snapshot', indicating a 'latest' build of a particular version)." />
<modifier name="prereleases" aliases="pre" value="true" valueList="0,1" description="For any repository, specifies that it should be used to look for prerelease software" />
<modifier name="read-only" aliases="ro" value="true" valueList="0,1" description="For any repository, specifies that modules installed from it are ALWAYS installed in non-developer mode, effectively making them read only" />
<!-- Repository types -->
<modifier name="type" value="true" aliases="t" description="Subclass of %IPM.Repo.Definition to create/modify/delete or implementation of %IPM.Repo.IPackageService or %IPM.Repo.IPublishService to enable/disable" />
</command>
<command name="load" dataPrefix="D">
<summary>
Loads a module from the specified directory into the current namespace.
</summary>
<description>
Loads a module from the specified directory into the current namespace.
Dependencies are also loaded automatically, provided that they can be found in
repositories configured with the 'repo' command.
</description>
<!-- Examples -->
<example description="Loads the module described in C:\module\root\path\module.xml">
load C:\module\root\path\
load C:\module\root\path\module-0.0.1.tgz
load C:\module\root\path\module-0.0.1.tar.gz
</example>
<example description="Loads the module described in C:\module\root\path\module.xml in developer mode and with verbose output.">
load -dev -verbose C:\module\root\path\
load -dev -verbose C:\module\root\path\module-0.0.1.tgz
</example>
<example description="Loads the module in branch feature-1 from remote repository https://github.com/user/repository.git.">
load https://github.com/user/repository.git
load https://github.com/user/repository.git -branch feature-1
</example>
<example description="Loads the module described in C:\module\root\path\module.xml without installing python dependencies">
load -bypass-py-deps C:\module\root\path\
</example>
<example description="Loads the module described in C:\module\root\path\module.xml but set pip timeout to 30 seconds">
load -extra-pip-flags "--timeout 30" C:\module\root\path\
</example>
<example description="Loads the module described in C:\module\root\path\module.xml using the C:\path\to\env.json1 and C:\path\to\env.json2 as the install time configuration">
load C:\module\root\path -env C:\path\to\env1.json;C:\path\to\env2.json
</example>
<!-- Modifiers -->
<modifier name="env" aliases="e" dataAlias="EnvFiles" value="true" description="Semicolon separated paths to the environment files in json format. See wiki for details." />
<modifier name="branch" aliases="b" dataAlias="Branch" value="true" description="The name of the branch in the repository" />
<modifier name="dev" dataAlias="DeveloperMode" dataValue="1" description="Sets the DeveloperMode flag for the module's lifecycle. Key consequences of this are that ^Sources will be configured for resources in the module, and installer methods will be called with the dev mode flag set. In addition, transactions will not be rolled back if installation fails." />
<modifier name="nodev" dataAlias="DeveloperMode" dataValue="0" description="Disables the DeveloperMode flag for the module's lifecycle." />
<modifier name="quiet" aliases="q" dataAlias="Verbose" dataValue="0" description="Produces minimal output from the command." />
<modifier name="verbose" aliases="v" dataAlias="Verbose" dataValue="1" description="Produces verbose output from the command." />
<modifier name="bypass-py-deps" dataAlias="BypassPyDeps" dataValue="1" description="Skip installing python dependencies" />
<modifier name="extra-pip-flags" dataAlias="ExtraPipFlags" value="true" description="Extra flags to pass to pip when installing python dependencies. Surround the flags (and values) with quotes if spaces are present. Default flags are "--target <target> --python-version <pyversion> --only-binary=:all:"." />
<modifier name="synchronous" value="false" deprecated="true" description="DEPRECATED. Dependencies are now always loaded synchronously with independent lifecycle phases doing their own multi-threading as needed." />
<modifier name="force" aliases="f" value="false" description="Allows the user to load a newer version of an existing module without running update steps." />
<modifier name="create-lockfile" aliases="lock" dataAlias="CreateLockFile" dataValue="1" description="Upon load, creates/updates the module's lock file." />
<!-- Parameters -->
<parameter name="path" required="true" description="Directory on the local filesystem, containing a file named module.xml" />
</command>
<command name="import">
<description>Imports classes from a file or file(s), reexporting to source control if needed.</description>
<!-- Examples -->
<example description="Import and compile the class or classes from the given file">
import C:\Temp\MyExport.xml
</example>
<example description="Import the classes from the given directory, located at its root level only. Classes are loaded but not compiled.">
import C:\Temp\MyFlatExportDir\ -norecurse -nocompile
</example>
<!-- Parameters -->
<parameter name="source" description="File or directory to import" required="true" />
<!-- Modifiers -->
<modifier name="quiet" aliases="q" description="Produces minimal output from the command." />
<modifier name="verbose" aliases="v" description="Produces verbose output from the command." />
<modifier name="norecurse" description="If importing a directory, do not recurse (default is to load directories recursively)" />
<modifier name="nocompile" description="Skip compiling imported classes (default is to compile them)" />
</command>
<command name="run-from-file" aliases="run">
<summary>Runs Package Manager Shell commands provided in a file.</summary>
<description>
Imports either a text file or a JSON file that contains Package Manager Shell commands and runs them sequentially
in the current namespace.
Expected format if the file is a text file (with a .txt extension):
Each line of the file should contain a single command to be run
Expected format if the file is a JSON file (with a .json extension):
The file must contain a single array whose items are JSON objects matching the following format -
{
"command": "command name",
"parameters": { ... },
"modifiers": { ... },
"custom_modifiers": { ... }
}
where each nested object contains key-value pairs. Note that for modifiers that have no value associated with them
(such as -verbose), the value of the key-value pair for the modifier is ignored.
</description>
<!-- Examples -->
<example description="Run the commands present in the text file.">
run-from-file C:\Temp\MyCommands.text, where contents of the file are as follows:
repo -name Test -p4 -path //Users/test/
install -dev TestModule -latest -DNoMapping=1 -DDeploy.Parameter="TESTDEPLOY"
</example>
<example description="Run the commands present in the JSON file.">
run C:\Temp\MyCommands.json, where contents of the file are as follows:
{
"commands": [
{
"command": "repo",
"modifiers": {
"name": "Test",
"p4": "",
"path": "//Users/test/"
}
},
{
"command": "install",
"parameters": {
"module": "TestModule"
},
"modifiers": {
"dev": "",
"latest": ""
},
"custom_modifiers": {
"Deploy.Parameter": "TESTDEPLOY"
}
}
]
}
</example>
<!-- Parameters -->
<parameter name="file" description="File to import" required="true" />
<!-- Modifiers -->
<modifier name="dry-run" aliases="d" description="Does not actually run the commands. Simply displays what would be run." />
</command>
<command name="install" dataPrefix="D">
<description>Installs a module available in a configured repository.</description>
<!-- Examples -->
<example description="Installs the most recent 1.x version of HS.JSON available in any configured repository in the current namespace.">
install HS.JSON 1.x
</example>
<example description="Installs the most recent version of HS.JSON from the `registry` repository.">
install registry/HS.JSON
</example>
<example description="Installs HS.JSON without installing python dependencies">
install -bypass-py-deps HS.JSON
</example>
<example description="Installs HS.JSON but set pip timeout to 30 seconds">
install -extra-pip-flags "--timeout 30" HS.JSON
</example>
<example description="Installs example-package using the /path/to/env1.json and /path/to/env2.json as the install time configuration">
install -env /path/to/env1.json;/path/to/env2.json example-package
</example>
<!-- Parameters -->
<parameter name="module" required="true" description="Name of module to install" />
<parameter name="version" description="Version (or version expression) of module to install; defaults to the latest available if unspecified." />
<!-- Modifiers -->
<modifier name="env" aliases="e" dataAlias="EnvFiles" value="true" description="Semicolon separated paths to the environment files in json format. See wiki for details." />
<modifier name="latest" aliases="l" description="Installs the latest available version of this module without prompting the user." />
<modifier name="prompt" aliases="p" description="Prompts user which version to install, if more then one found." />
<modifier name="dev" dataAlias="DeveloperMode" dataValue="1" description="Sets the DeveloperMode flag for the module's lifecycle. Key consequences of this are that ^Sources will be configured for resources in the module, and installer methods will be called with the dev mode flag set. In addition, transactions will not be rolled back if installation fails." />
<modifier name="quiet" aliases="q" dataAlias="Verbose" dataValue="0" description="Produces minimal output from the command." />
<modifier name="verbose" aliases="v" dataAlias="Verbose" dataValue="1" description="Produces verbose output from the command." />
<modifier name="keywords" aliases="k" value="true" description="Searches for modules matching some set of keywords." />
<modifier name="bypass-py-deps" dataAlias="BypassPyDeps" dataValue="1" description="Skip installing python dependencies" />
<modifier name="extra-pip-flags" dataAlias="ExtraPipFlags" value="true" description="Extra flags to pass to pip when installing python dependencies. Surround the flags (and values) with quotes if spaces are present. Default flags are "--target <target> --python-version <pyversion> --only-binary=:all:"."/>
<modifier name="synchronous" value="false" deprecated="true" description="DEPRECATED. Dependencies are now always loaded synchronously with independent lifecycle phases doing their own multi-threading as needed." />
<modifier name="force" aliases="f" value="false" description="Allows the user to install a newer version of an existing module without running update steps." />
<modifier name="create-lockfile" aliases="lock" dataAlias="CreateLockFile" dataValue="1" description="Upon install, creates/updates the module's lock file." />
</command>
<command name="reinstall" dataPrefix="D">
<summary>Reinstalls the already installed version of the provided module.</summary>
<description>
Reinstalls an already-installed module from the latest version available in a configured
repository. By default, updates dependencies of that module as well.
</description>
<!-- Examples -->
<example description="Reinstalls the currently-installed version of the MyTestModule module, in development mode">
reinstall -dev MyTestModule
</example>
<example description="Reinstalls the currently-installed vresion of the MyTestModule module without reinstalling python dependencies">
reinstall -bypass-py-deps MyTestModule
</example>
<example description="Reinstalls MyTestModule but set pip timeout to 30 seconds">
reinstall -extra-pip-flags "--timeout 30" MyTestModule
</example>
<example description="Reinstalls example-package using the /path/to/env1.json and /path/to/env2.json as the install time configuration">
reinstall -env /path/to/env1.json;/path/to/env2.json example-package
</example>
<!-- Parameters -->
<parameter name="module" required="true" description="Name of module to reinstall" />
<modifier name="dev" dataAlias="DeveloperMode" dataValue="1" description="Sets the DeveloperMode flag for the module's lifecycle. Key consequences of this are that ^Sources will be configured for resources in the module, and installer methods will be called with the dev mode flag set." />
<!-- Modifiers -->
<modifier name="env" aliases="e" dataAlias="EnvFiles" value="true" description="Semicolon separated paths to the environment files in json format. See wiki for details." />
<modifier name="quiet" aliases="q" dataAlias="Verbose" dataValue="0" description="Produces minimal output from the command." />
<modifier name="verbose" aliases="v" dataAlias="Verbose" dataValue="1" description="Produces verbose output from the command." />
<modifier name="shallow" aliases="s" dataAlias="UpdateSnapshots" dataValue="0" description="Suppresses updating of dependencies with '+snapshot' versions." />
<modifier name="bypass-py-deps" dataAlias="BypassPyDeps" dataValue="1" description="Skip installing python dependencies" />
<modifier name="extra-pip-flags" dataAlias="ExtraPipFlags" value="true" description="Extra flags to pass to pip when installing python dependencies. Surround the flags (and values) with quotes if spaces are present. Default flags are "--target <target> --python-version <pyversion> --only-binary=:all:"."/>
</command>
<command name="uninstall" dataPrefix="D">
<summary>Uninstalls a module currently installed in this namespace.</summary>
<description>
Uninstalls a module currently installed locally. This will be prevented if other modules
depend on the named module, unless the -force flag is specified.
</description>
<!-- Examples -->
<example description="Uninstalls HS.JSON from the current namespace.">
uninstall HS.JSON
</example>
<!-- Parameters -->
<parameter name="module" description="Name of module to uninstall" />
<!-- Modifiers -->
<modifier name="all" aliases="a" description="Uninstalls all modules installed in the current namespace." />
<modifier name="global" aliases="g" dataAlias="Clean.GlobalScope" dataValue="1" description="Also uninstalls modules with 'global scope' (available in all namespaces); by default, these are skipped." />
<modifier name="force" aliases="f" description="If specified, the module will be uninstalled even if other modules depend on it." />
<modifier name="recurse" aliases="r" description="Also recursively uninstall dependencies. By default, will not uninstall dependencies that are also required by other installed modules; the -force flag overrides this." />
<modifier name="quiet" aliases="q" dataAlias="Verbose" dataValue="0" description="Produces minimal output from the command." />
<modifier name="verbose" aliases="v" dataAlias="Verbose" dataValue="1" description="Produces verbose output from the command." />
<modifier name="purge" dataAlias="Purge" dataValue="1" description="Purge data from tables during uninstall." />
</command>
<command name="exec" aliases="cos">
<description>
Executes the provided ObjectScript expression.
</description>
<!-- Examples -->
<example description="Run the Objectscript expression to set the namespace to MYAPP">
cos set $Namespace = "MYAPP"
</example>
<!-- Parameters -->
<parameter name="expression" required="true" trailing="true" description="ObjectScript expression(s) to execute" />
</command>
<command name="orphans">
<description>
Lists resources in the current namespace's default code database that are not part of any module.
</description>
<!-- Examples -->
<example description="List resources that are classes that are not part of any module in the current namespace">
orphans -type CLS
</example>
<!-- Modifiers -->
<modifier name="type" aliases="t" value="true" description="Type (e.g., extension) of resource to show; if unspecified, all types are included." />
</command>
<command name="list-installed" aliases="list">
<description>
Lists modules installed in the current namespace.
</description>
<!-- Examples -->
<example description="Shows all installed modules in tree format.">
list-installed -tree
</example>
<example description="Shows all installed Python packages.">
list -python
</example>
<!-- Parameters -->
<parameter name="searchString" description="Search string, * can be used." />
<!-- Modifiers -->
<modifier name="tree" aliases="t" description="If specified, show dependency tree for installed modules." />
<modifier name="description" aliases="d" dataAlias="Desc" dataValue="1" description="Additional information is displayed for each module." />
<modifier name="showsource" aliases="ss" description="If specified, show dependency list with local source for installed modules." />
<modifier name="showtime" aliases="st" description="If specified, show the time of last update for each module" />
<modifier name="showupstream" aliases="su" description="If specified, show the latest version for each module in configured repos if it's different than the local version." />
<modifier name="repository" aliases="repo" value="true" description="If specified, only show modules installed that belong to the provided repository." />
<modifier name="python" aliases="py" description="If specified, lists installed Embedded Python libraries instead of IPM modules." />
</command>
<command name="list-dependents" aliases="dependents">
<description>
Lists modules dependent on the specified module.
</description>
<!-- Examples -->
<example description="Lists all currently-installed modules dependent on all 'HS.JSON' versions">
list-dependents HS.JSON
</example>
<example description="Lists all currently-installed modules in the 'AppModules' repository dependent on all 'HS.JSON' versions">
list-dependents -repos AppModules HS.JSON
</example>
<example description="Lists all currently-installed modules in the 'AppModules' repository dependent on 'HS.JSON' version '0.0.1+snapshot', as a tree">
dependents -t -r AppModules HS.JSON 0.0.1+snapshot
</example>
<!-- Parameters -->
<parameter name="module" required="true" description="Name of module for which dependent modules will be found" />
<parameter name="version" description="Version of the module for which dependent modules will be found (in all configured repositories)" />
<!-- Modifiers -->
<modifier name="tree" aliases="t" description="If specified, show as a tree (rather than a flattened list)" />
<modifier name="repos" aliases="r" value="true" description="Comma-separated list of repository names to search in. If unspecified, the version of the module in the current namespace will be used instead." />
</command>
<command name="default-modifiers" dataPrefix="D">
<description>
Manages default modifiers to use for all package manager commands in the current namespace.
</description>
<!-- Modifiers -->
<modifier name="set" description="Set the default modifiers to the provided modifiers. Note: this just appends to existing modifiers. DOES NOT delete any defaults." />
<modifier name="get" description="Prints the default modifiers to the current device." />
<modifier name="delete" description="Deletes all registered default modifiers." />
<!-- Examples -->
<example description="Set custom modifiers -DNoTransaction=1 and -DUpdateSnapshots=1 with every package manager command">
default-modifiers -set -DNoTransaction=1 -DUpdateSnapshots=1
</example>
<example description="Get currently set custom modifiers.">
default-modifiers -get
</example>
<example description="Delete currently set custom modifiers.">
default-modifiers -delete
</example>
</command>
<command name="arrange">
<description>
Rearranges the resources in a module manifest to follow the standard format.
</description>
<!-- Parameters -->
<parameter name="module" description="Name of module to rearrange" />
<!-- Modifiers -->
<modifier name="all" description="If specified, rearrange all modules loaded in development mode (rather than just the current one)." />
</command>
<command name="dependency-analyzer" aliases="deps">
<summary>
Computes references to other items/modules for a given module/item.
</summary>
<description>
For a module, inspects all items in the provided module and checks for invalid references to items
that are not in the module and not in any of the module's dependencies.
For an item, finds all its references to other items, or optionally list
just the invalid references of the item as well.
Dependency analyzer supports .cls and .inc items. Other item types are not yet supported.
The references are written to the current device.
</description>
<!-- Parameters -->
<parameter name="moduleOrItem" required="true" description="Name of module / item to inspect" />
<!-- Modifiers -->
<modifier name="invalid-only" value="true" description="Will only be applied when the input is an item name. Default to 1, i.e default to show invalid references only. If specified to 0, will show all references to the item." />
<modifier name="ignore-str" value="true" description="If specified, ignore specific string references provided as a comma-separated string, including class names" />
<modifier name="ignore-str-all" description="If specified, ignore all string references, including class names" />
<modifier name="direct-deps-only" description="If specified, flag references based on direct dependencies only instead of allowing for transitive dependencies" />
<!-- Examples -->
<example description="Runs the dependency analyzer on the module MyModuleName to find invalid references, and ignore string references MyClassName1 and MyClassName2.">
deps MyModuleName -ignore-str MyClassName1,MyClassName2
</example>
<example description="Runs the dependency analyzer on item MyClassName3.cls to find all its references, and ignore all string references.">
deps MyClassName3.cls -invalid-only 0 -ignore-str-all
</example>
<example description="Runs the dependency analyzer on item MyIncludeName.inc to find all invalid references in it.">
deps MyIncludeName.inc
</example>
</command>
<command name="version" aliases="ver">
<description>
Prints the currently-installed package manager and registry version (excluding +snapshot or other build information)
</description>
</command>
<command name="generate" aliases="gen">
<description>Generates module.xml</description>
<example description="Generates module.xml for your module in interactive mode ">generate</example>
<example description="Generates template in the specified folder /my/path">generate -t /my/path</example>
<example description="Export CLS,MAC,INC,DFI in the specified folder /my/path/src">
generate /my/path -export 00000,PacketName2,IgnorePacket2^00000,PacketName3,IgnorePacket3
byte=1 isGenerated
byte=2 isSystem
byte=3 isPercented
byte=4 isMapped
byte=5 isDFI
</example>
<modifier name="template" aliases="t" description="Generates module.xml template in the specified folder" />
<modifier name="author" aliases="a" description="Request information about the author" />
<parameter name="path" description="Directory on the local filesystem, containing a file named module.xml" />
<modifier name="export" aliases="e" value="true" description="Export resource in path" />
</command>
<command name="search" aliases="find">
<description>Shows all modules matching the search string in all configured registries</description>
<example description="Shows all versions of all modules starting with `zpm`">search -versions zpm*</example>
<modifier name="show-repo" aliases="r" dataAlias="Repo" dataValue="1" description="Shows github repository only for each module." />
<modifier name="description" aliases="d" dataAlias="Description" dataValue="1" description="Shows description for each module." />
<modifier name="versions" dataAlias="AllVersions" dataValue="1" description="Shows all versions for each module." />
<parameter name="searchString" description="Search string, * can be used" />
<example description="Shows a description of all modules in the name of which there is a context">find -d *tools*</example>
</command>
<command name="namespace" aliases="zn">
<description>See list modules in namespace and go to the namespace</description>
<example description="Show all modules in all namespaces">zn *</example>
<example description="Show all modules in namespaces by context">zn sql*</example>
<parameter name="name" description="Name namespace, * or context name*" />
<modifier name="description" aliases="d" dataAlias="Description" dataValue="1" description="Shows description for each module." />
</command>
<command name="enable">
<summary>
Enable IPM in other namespaces.
</summary>
<!-- Modifiers -->
<modifier name="version" aliases="v" value="true" description="A special version of IPM can be provided. If not specified, the latest version from the registry will be installed (hence is not required if quiet flag is set)."/>
<modifier name="namespaces" aliases="ns" value="true" description="Comma-separated namespaces in which IPM needs to be enabled."/>
<modifier name="globally" aliases="g" description="Will install IPM in all explicit namespaces that currently do not have IPM installed. Unless using it together with the -map option, will not include %SYS. By default, this modifier is not set and will not install globally."/>
<modifier name="local-only" description="If specified, only local artifacts will be used for installation. By default, this modifier is not set and will not limit to local artifacts." />
<modifier name="allow-upgrade" description="If specified, will also check for IPM version in specified namespaces and upgrade if version is lower than the target version. By default, this modifier is not ste and will not allow upgrade." />
<modifier name="map" aliases="m" description="If specified, will map IPM code from the current namespace-default code database rather than installing a separate copy." />
<modifier name="repos" aliases="r" description="If specified, will map repository settings across namespaces. Must be used together with -map." />
<modifier name="remote" value="true" description="If specified, will use fetch IPM versions from this remote repository. If this is omitted and multiple remote repositories are present, an error will occur." />
<modifier name="quiet" aliases="q" description="Quiet mode. By default, this modifier is not set and will display the contents onto the terminal/caller command line." />
<modifier name="preview" aliases="p" description="Preview what will be changed without actually making the changes." />
<modifier name="community" description="If specified, will reset repository to the community repository and map IPM to all namespaces along with the repository settings. This is functionaly equivalent to "repo -delete-all", "repo -reset-defaults", and "enable -map -repos -globally". With this modifier, all other modifiers will be ignored."/>
<!-- Examples -->
<example description="Make IPM available in all namespaces (including %SYS) by mapping the version in the current namespace default routine database. Namespace-specific installation will override this.">
enable -map -globally
</example>
<example description="Install IPM version 0.3.4 from the remote registry namd "registry" in quiet mode in namespaces: NS1, NS2, NS3.">
enable -v 0.3.4 -q -ns NS1,NS2,NS3 -remote registry
</example>
<example description="Install IPM in all non-%SYS explicit namespaces, and select version later in terminal prompt menu. This works if there is only 1 remote repository configured.">
enable -globally
</example>
<example description="User wants to get the latest version of IPM from the registry server, and install it in all non-%SYS explicit namespaces. This works if there is only 1 remote repository configured.">
enable -v latest -globally
</example>
<example description="Install or upgrade IPM to latest IPM version in namespaces: NS1, NS2, NS3. This works if there is only 1 remote repository configured.">
enable -v latest -allow-upgrade NS1,NS2,NS3
</example>
<example description="Reset repository to the community repository and map IPM to all namespaces along with the repository settings.">
enable -community
</example>
</command>
<command name="unmap">
<summary>Unmap %IPM package and routines in specified namespaces.</summary>
<description>
Unmap %IPM package and routines in specified namespaces. Will Skip non-mapped namespaces.
If repository settings are mapped, will also unmap repository settings.
</description>
<modifier name="namespaces" aliases="ns" value="true" description="Comma-separated namespaces in which IPM mapping needs to be deleted."/>
<modifier name="globally" aliases="g" description="Will unmap IPM in all explicit namespaces that currently do not have IPM installed."/>
<modifier name="quiet" aliases="q" description="Quiet mode. By default, this modifier is not set and will display the contents onto the terminal/caller command line." />
<modifier name="repos-only" description="If specified, will only unmap repository settings across namespaces. This doesn't affect mapping of IPM packages and routines." />
<example description="Unmap IPM from namespaces NS1, NS2, NS3.">
unmap -ns NS1,NS2,NS3
</example>
<example description="Unmap IPM from all namespaces">
unmap -g
</example>
</command>
<command name="module-version" aliases="modver">
<description>
Updates the version of the module in the current namespace.
</description>
<parameter name="module" required="true" description="Name of the module to update the version for." />
<parameter name="version" description="Either a valid SemVer string, or 'major', 'minor', 'patch'. If it's 'major', 'minor', or 'patch', will bump the cooresponding part of SemVer." />
<modifier name="prerelease" value="true" aliases="p" description="Set the prerelease to a specific value" />
<modifier name="build" value="true" aliases="b" description="Set the build to a specific value" />
<modifier name="force" description="Permit the version to be downgraded. By default, trying to downgrade the version will fail" />
<modifier name="quiet" aliases="q" description="Suppress output (except for errors)" />
<example description="Sets the version of the module HS.JSON to 1.2.3">
module-version HS.JSON 1.2.3
</example>
<example description="Bump the major version the module HS.JSON. If current version is 1.2.3, the new version will be 2.0.0">
module-version HS.JSON major
</example>
<example description="Bump the minor version and set prerelease to 'alpha' and build to 'xyz'. If current version is 1.2.3, the new version will be 1.3.0-alpha+xyz">
module-version HS.JSON minor -prerelease alpha -build xyz
</example>
<example description="Downgrade the version to 1.2.3. If the current version is 1.3.0, this will still work because the force flag is set.">
module-version HS.JSON 1.2.3 -force
</example>
</command>
<command name="information" aliases="info">
<description>Output information about the current ZPM environment.</description>
<modifier name="verbose" aliases="v" description="Show more detailed information"/>
<example description="Show basic information about the current ZPM environment">
info
</example>
<example description="Show detailed information about the current ZPM environment">
info -verbose
</example>
</command>
<command name="history" aliases="log" dataPrefix="D">
<summary>Manage history of package installation/uninstallation.</summary>
<description>Manage history of package installation/uninstallation. Commands logged are install, load, uninstall, and update. By default, all entries will be affected. To specify filters, use the -Dcol=val syntax. See examples for more.</description>
<modifier name="globally" aliases="g" description="If specified, will affect all namespaces instead of the current one. Defaults to false."/>
<modifier name="sort" aliases="asc" value="true" description="List the history logs in a specific order. Allowed values are asc and desc. Default behaviour is to list logs in descending order of %ID."/>
<modifier name="limit" value="true" description="If specified, will only list the specified number of logs. If set to 0, all logs will be displayed. If omitted, will use the value returned by `zpm "config get DefaultLogEntryLimit"`."/>
<modifier name="showPhases" aliases="p,phases" description="Show lifecycle phase information in details view." />
<modifier name="confirm" value="false" description="If present, will delete all records in the current namespace. Ignored if -globally is passed too."/>
<modifier name="verbose" aliases="v" dataAlias="verbose" dataValue="1" description="Produces verbose output from the command." />
<parameter name="action" required="false" description="One of history actions: find (default), details, delete, schema" />
<parameter name="argument" required="false" description="Argument for `details` command" />
<example description="Show history of all packages in the current namespace in descending order">history find </example>
<example description="Show history of all packages in the current namespace where command starts with "load"">history find -DCommandString="load*"</example>
<example description="Show history of all packages in the current namespace where the command has been committed `to disk`. Note that committed != successful, as all actions in dev mode will be committed regardless of success.">history find -DCommitted=1</example>
<example description="Show history of all packages in the current namespace where the command has errored">history find -DSucess="0*"</example>
<example description="Show history of all packages in the current namespace where start time is later than 2000-01-01 00:00:00">history find -DTimeStart=">2000-01-01 00:00:00"</example>
<example description="Show 5 history records in the current namespace in ascending order">history find -sort asc -limit 5</example>
<example description="Show column names that the table can be filtered by">history schema</example>
<example description="Show only installation history of package "zpip" in the current namespace ">history find -Daction=install -Dpackage=zpip</example>
<example description="Show only installation history of package "zpip" in all namespaces ">history find -globally -Daction=install -Dpackage=zpip</example>
<example description="Delete all histories in the namespace">history delete -confirm</example>
<example description="Show details of history item with ID 3 and information for each undergone lifecyle phase">history details 3 -phases</example>
</command>
</commands>
}
ClassMethod %GetCommandStructure(Output pCommandStructure)
{
do ..%GetOneCommandStructure(.pCommandStructure)
do ##class(%IPM.Repo.Definition).%GetCommandStructure(.tCommandStructure)
merge pCommandStructure("repo") = tCommandStructure("repo")
}
/// @API.Method
ClassMethod Shell(
pCommand As %String = "",
pTerminateOnError As %Boolean = 0,
pHaltOnComplete As %Boolean = 0) As %Status
{
set tSC = $$$OK
do ..ShellInternal(pCommand,.tException)
if $isobject(tException) {
if pTerminateOnError {
do $system.Process.Terminate($job,1)
}
set tSC = tException.AsStatus()
}
if pHaltOnComplete {
halt
}
quit tSC
}
ClassMethod TerminalPrompt() As %String
{
set tp=##class(%SYSTEM.Process).TerminalPrompt()
set prompt="zpm:"
set del=$$$FormattedLine(..TerminalPromptColor(),">")
if ..TerminalPromptColor()=$$$Default { set tp=2 }
for i=1:1:$length(tp,",") {
if $piece(tp,",",i)=1 { set prompt=prompt_$piece($system,":")_del continue}
elseif $piece(tp,",",i)=2 { set prompt=prompt_$namespace_del continue}
elseif $piece(tp,",",i)=3 { set prompt=prompt_$piece($system,":",2)_del continue}
elseif $piece(tp,",",i)=4 { set prompt=prompt_$ztime(+$piece($horolog,",",2),1)_del continue}
elseif $piece(tp,",",i)=5 { set prompt=prompt_$job_del continue}
elseif $piece(tp,",",i)=8,$tlevel { set prompt=prompt_"TL"_$tlevel_del continue}
// for zpm shell 7 do not need to be implemented
}
quit prompt
}
/// @API.Method
/// Get Version modules and current registry
/// example do ##class(%IPM.Main).GetVersion("zpm,zpm-registry",.out,.list)
ClassMethod GetVersion(
ModuleName,
ByRef out,
list)
{
do ..GetListModules("*", ModuleName, .list)
for i=1:1 {
quit:'$data(list(i),ns)
set ns=$listget(ns,1)
for ii=1:1 {
quit:'$data(list(i,"modules",ii),module)
set out($listget(module,1))=$listbuild(ns,$listget(module,2))
}
}
set sc=$$$OK
set sql="select URL from %IPM_Repo_Remote.Definition where Enabled = 1" _
" union " _
"select URL from %IPM_Repo_Oras.Definition where Enabled = 1"
,rs=##class(%ResultSet).%New()
,sc=rs.Prepare(sql)
set:sc sc=rs.Execute("")
if sc {
quit:'rs.%Next()
set out=$zconvert(rs.Get("URL"),"l")
}
quit sc
}
ClassMethod GetSystemMode()
{
new $namespace
set $namespace = "%SYS"
if $$$ISOK(##class(Config.Startup).Get(.tProperties)) {
quit $get(tProperties("SystemMode"))
}
quit ""
}
/// Return a list of messages to display when the shell is first started
/// For messages that are too long to fit in a box, they should be returned in the outOfBoxMessage parameter
ClassMethod BuildIntroMessages(Output outOfBoxMessage As %String) As %List
{
set cls = "%ZHSLIB.HealthShareMgr", mthd = "VersionInfo"
if $system.CLS.IsMthd(cls, mthd) {
set outOfBoxMessage = $classmethod(cls, mthd)
} else {
set outOfBoxMessage = $zversion
}
do ##class(%IPM.Main).GetVersion($$$IPMModuleName,.out)
if $get(out) = "" {
set registryInfo = $$$FormattedLine($$$Cyan, "No registry configured")
} else {
set registryInfo = "Current registry "_$$$FormattedLine($$$Cyan, out)
}
set systemMode = ..GetSystemMode()
if systemMode = "" {
set systemMode = "System Mode: <unset>"
} else {
set systemMode = "System Mode: " _ systemMode
}
set mirrorStatus = $system.Mirror.GetStatus()
set mirrorStatus = "Mirror Status: " _ mirrorStatus
set list = $listbuild(
"Welcome to the Package Manager Shell (ZPM). Version: "_$$$FormattedLine($$$Green, ..GetVersionModule($$$IPMModuleName)),
"Enter q/quit to exit the shell. Enter ?/help to view available commands",
registryInfo,
systemMode,
mirrorStatus
)
quit list
}
/// For use in unit tests that need to test if a command threw any exceptions.
ClassMethod ShellInternal(
pCommand As %String,
Output pException As %Exception.AbstractException) [ Internal ]
{
new $$$DeprecationWarned
// Keep a reference of the singleton, so subsequent .%Get() calls return the same instance
set configReference = ##class(%IPM.General.EnvironmentConfig).%Get()
set pException = $$$NULLOREF
set tOneCommand = 0
set tCommand = $get(pCommand)
if (tCommand '= "") {
set tOneCommand = 1
}
set introMessageList = ..BuildIntroMessages(.outOfBoxMessage)
set tInShell = 0
for {
kill $$$DeprecationWarned
try {
// Have intro message just for first entrance to shell
// Ensure not displayed if its just one command
if 'tInShell && 'tOneCommand {
do ..DrawBorder(introMessageList, ..TerminalPromptColor())
write $get(outOfBoxMessage),! // Display long messages outside of the box
set tInShell = 1
}
if (tCommand = "") {
write ..TerminalPrompt()
read tCommand
write !
}
if (tCommand = "") {
#; Do ..%Help()
quit
}
kill tCommandInfo
// Parse command
$$$ThrowOnError(..%ParseCommandInput(tCommand,.tParsedCommandInfo))
// Warn for deprecated parameters/modifiers
do ..WarnOnDeprecatedModifiersOrParameters(.tParsedCommandInfo)
// Merge defaults first so they can be overwritten by commands
do ..GetNamespaceDefaultModifiers(.tDefaultArray)
merge tCommandInfo("data") = tDefaultArray
merge tCommandInfo = tParsedCommandInfo
// Stashed for use in %IPM.General.History:Init
new $$$ZPMCommandToLog
set $$$ZPMCommandToLog = tCommand
if (tCommandInfo = "quit") {
return
} elseif (tCommandInfo = "help") {
do ..%Help(.tCommandInfo)
} elseif (tCommandInfo = "init") {
do ..Init(.tCommandInfo)
} elseif (tCommandInfo = "search") {
do ..Search(.tCommandInfo)
} elseif (tCommandInfo = "repo") {
do ..Repository(.tCommandInfo)
} elseif (tCommandInfo = "load") {
do ..Load(.tCommandInfo)
} elseif (tCommandInfo = "exec") {
write !
xecute tCommandInfo("parameters","expression")
} elseif (tCommandInfo = "install") {
do ..Install(.tCommandInfo)
} elseif (tCommandInfo = "reinstall") {
do ..Reinstall(.tCommandInfo)
} elseif (tCommandInfo = "uninstall") {
do ..Uninstall(.tCommandInfo)
} elseif (tCommandInfo = "list-installed") {
do ..ListInstalled(.tCommandInfo)
} elseif (tCommandInfo = "list-dependents") {
do ..ListDependents(.tCommandInfo)
} elseif (tCommandInfo = "orphans") {
do ..ListOrphans(.tCommandInfo)
} elseif (tCommandInfo = "default-modifiers") {