Skip to content

Commit 1a52341

Browse files
StartAutomatingStartAutomating
StartAutomating
authored and
StartAutomating
committed
feat: Use-Module ( Fixes #1130 )
Fixing parameters and fulfilling promise
1 parent dd56ee1 commit 1a52341

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

docs/Use-Module.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
Use-Module
2+
----------
3+
4+
### Synopsis
5+
Uses a module.
6+
7+
---
8+
9+
### Description
10+
11+
Uses a module.
12+
13+
This can either:
14+
15+
* If present, run a module's `Use` function, method, or script property.
16+
* Otherwise, run a script block in the module's context.
17+
18+
* Run a module's `Use` function, if present
19+
* Call a module's `Use` method, if present
20+
21+
In all cases, the script block should be run in the module's context, using dot-sourcing.
22+
23+
---
24+
25+
### Examples
26+
> EXAMPLE 1
27+
28+
```PowerShell
29+
Get-Module PipeScript | Use-Module -ScriptBlock { $myInvocation.MyCommand.ScriptBlock.Module }
30+
```
31+
32+
---
33+
34+
### Parameters
35+
#### **Name**
36+
The name of the module
37+
38+
|Type |Required|Position|PipelineInput |Aliases |
39+
|----------|--------|--------|--------------|----------|
40+
|`[String]`|false |1 |true (ByValue)|ModuleName|
41+
42+
#### **ScriptBlock**
43+
The script block to use.
44+
45+
|Type |Required|Position|PipelineInput|
46+
|---------------|--------|--------|-------------|
47+
|`[ScriptBlock]`|false |2 |false |
48+
49+
#### **ArgumentList**
50+
The list of arguments to pass to the script block.
51+
52+
|Type |Required|Position|PipelineInput|Aliases |
53+
|--------------|--------|--------|-------------|------------------|
54+
|`[PSObject[]]`|false |3 |false |Arguments<br/>Args|
55+
56+
#### **Parameter**
57+
Any named parameters to pass to the script block.
58+
59+
|Type |Required|Position|PipelineInput |Aliases |
60+
|---------------|--------|--------|---------------------|----------|
61+
|`[IDictionary]`|false |4 |true (ByPropertyName)|Parameters|
62+
63+
---
64+
65+
### Syntax
66+
```PowerShell
67+
Use-Module [[-Name] <String>] [[-ScriptBlock] <ScriptBlock>] [[-ArgumentList] <PSObject[]>] [[-Parameter] <IDictionary>] [<CommonParameters>]
68+
```

0 commit comments

Comments
 (0)