1
1
---
2
2
description : Describes the purpose of the Crescendo module.
3
3
Locale : en-US
4
- ms.date : 01/21 /2022
4
+ ms.date : 08/18 /2022
5
5
online version : https://docs.microsoft.com/powershell/module/microsoft.powershell.crescendo/about/about_Microsoft.PowerShell.Crescendo?view=ps-modules.1&WT.mc_id=ps-gethelp
6
6
schema : 2.0.0
7
7
title : about_Microsoft.PowerShell.Crescendo
@@ -10,26 +10,26 @@ title: about_Microsoft.PowerShell.Crescendo
10
10
11
11
## about_Microsoft.PowerShell.Crescendo
12
12
13
- ## SHORT DESCRIPTION
13
+ ## Short description
14
14
15
15
The PowerShell Crescendo module provides a novel way to create proxy functions
16
16
for native commands via ` JSON ` configuration files.
17
17
18
- ## LONG DESCRIPTION
18
+ ## Long description
19
19
20
20
PowerShell is capable of invoking native applications like any shell. However,
21
21
it would improve the experience if the native command could participate in the
22
22
PowerShell pipeline and take advantage of the parameter behaviors that are part
23
23
of PowerShell.
24
24
25
- The PowerShell Crescendo module provides a way to more easily take advantage of
26
- the PowerShell pipeline by invoking the native executable, facilitating
27
- parameter handling, and converting text output into objects.
25
+ The PowerShell Crescendo module provides a way to take advantage of the
26
+ PowerShell pipeline by invoking the native executable, facilitating parameter
27
+ handling, and converting text output into objects.
28
28
29
29
## JSON Configuration
30
30
31
31
The PowerShell Crescendo module provides a way to create a small bit of JSON
32
- that is used to create a function that calls the native command.
32
+ that's used to create a function that calls the native command.
33
33
34
34
An annotated schema is provided as part of the module that can improve the
35
35
authoring process.
@@ -41,9 +41,9 @@ commands in the same way you do with cmdlets.
41
41
42
42
## Output Handling
43
43
44
- It is also possible to provide a script block that can be used to convert the
45
- output from the native command into objects. If the native command emits ` json `
46
- or ` xml ` it is as simple as:
44
+ It's also possible to create a script block that can be used to convert the
45
+ output from the native command into objects. If the native command emits JSON
46
+ or XML it can be as simple as:
47
47
48
48
``` json
49
49
"OutputHandler" : [
@@ -54,12 +54,12 @@ or `xml` it is as simple as:
54
54
55
55
However, script blocks of arbitrary complexity may also be used.
56
56
57
- ## EXAMPLES
57
+ ## Examples
58
58
59
- A number of samples are provided as part of the module, you can see these in
60
- the Samples directory in the module base directory.
59
+ Several samples are provided as part of the module. You can find these in the
60
+ ` Samples ` directory of the module base directory.
61
61
62
- A very simple example is as follows to wrap the unix ` /bin/ls ` command:
62
+ The following JSON is a minimal example that wraps the unix ` /bin/ls ` command:
63
63
64
64
``` json
65
65
{
@@ -68,32 +68,42 @@ A very simple example is as follows to wrap the unix `/bin/ls` command:
68
68
"Noun" :" FileList" ,
69
69
"OriginalName" : " /bin/ls" ,
70
70
"Parameters" : [
71
- {"Name" : " Path" ,"OriginalName" : " " , "OriginalPosition" : 1 , "Position" : 0 , "DefaultValue" : " ." },
72
- {"Name" : " Detail" ,"OriginalName" : " -l" ,"ParameterType" : " switch" }
71
+ {
72
+ "Name" : " Path" ,
73
+ "OriginalName" : " " ,
74
+ "OriginalPosition" : 1 ,
75
+ "Position" : 0 ,
76
+ "DefaultValue" : " ."
77
+ },
78
+ {
79
+ "Name" : " Detail" ,
80
+ "OriginalName" : " -l" ,
81
+ "ParameterType" : " switch"
82
+ }
73
83
]
74
84
}
75
85
```
76
86
77
87
The name of the proxy function is ` Get-FileList ` and has two parameters:
78
88
79
- - Path
89
+ - ** Path**
80
90
- Which is Position 0, and has a default value of "."
81
- - Detail
91
+ - ** Detail**
82
92
- Which is a switch parameter and adds ` -l ` to the native command parameters
83
93
84
94
A couple of things to note about the Path parameter
85
95
86
96
- The ` OriginalPosition ` is set to 1 and the ` OriginalName ` is set to an empty
87
- string. This is because some native commands have a parameter which is _ not_
88
- named and must be the last parameter when executed. All parameters will be
89
- ordered by the value of ` OriginalPosition ` (the default is 0) and when the
90
- native command is called, those parameters (and their values) will be put in
91
- that order.
97
+ string. This is because some native commands have a parameter that is _ not_
98
+ named and must be the last parameter when executed. All parameters get
99
+ ordered by the value of ` OriginalPosition ` (the default is 0). When the
100
+ native command is called, those parameters (and their values) are put in that
101
+ order.
92
102
93
103
In this example, there is no output handler defined, so the text output of the
94
- command will be returned to the pipeline.
104
+ command is returned to the pipeline.
95
105
96
- A more complicated example which wraps the linux ` apt ` command follows :
106
+ The following is a more complicated example that wraps the linux ` apt ` command:
97
107
98
108
``` json
99
109
{
@@ -117,7 +127,7 @@ A more complicated example which wraps the linux `apt` command follows:
117
127
118
128
In this case, the output handler converts the text output to a ` pscustomobject `
119
129
to enable using other PowerShell cmdlets. When run, this provides an object
120
- which encapsulates the ` apt ` output
130
+ that encapsulates the ` apt ` output
121
131
122
132
``` powershell
123
133
PS> get-installedpackage | ?{ $_.name -match "libc"}
@@ -138,16 +148,10 @@ Count Name Group
138
148
82 amd64 {@{Name=apt; Version=2.0.2ubuntu0.1; Architecture=amd64; State=System.String[]}, @{Name=base-files…
139
149
```
140
150
141
- ## TROUBLESHOOTING NOTE
142
-
143
- The PowerShell Crescendo module is still very early in the development process,
144
- so we expect changes to be made.
145
-
146
- One issue is that the output handler is currently a string, so constructing the
147
- script block may be complex; semi-colons will be required to separate
148
- statements. This may be addressed in a later version.
151
+ ## See also
149
152
150
- ## SEE ALSO
153
+ The PowerShell Crescendo module is still in the development process, so we
154
+ expect changes to be made.
151
155
152
156
The GitHub repository may be found at:
153
157
[ https://github.com/PowerShell/Crescendo ] ( https://github.com/PowerShell/Crescendo ) .
@@ -158,6 +162,6 @@ command wrapping can be found here:
158
162
- [ Part 1] ( https://devblogs.microsoft.com/powershell/native-commands-in-powershell-a-new-approach/ )
159
163
- [ Part 2] ( https://devblogs.microsoft.com/powershell/native-commands-in-powershell-a-new-approach-part-2 ) )
160
164
161
- ## KEYWORDS
165
+ ## Keywords
162
166
163
167
Native Command
0 commit comments