File tree 3 files changed +78
-7
lines changed
PowerShellEditorServices/Commands/Public
src/PowerShellEditorServices/Extensions
3 files changed +78
-7
lines changed Original file line number Diff line number Diff line change 1
1
function Out-CurrentFile {
2
+ <#
3
+ . EXTERNALHELP ..\PowerShellEditorServices.Commands-help.xml
4
+ #>
5
+ [CmdletBinding ()]
2
6
param (
3
- [Parameter (ValueFromPipeline )]
4
- $data
7
+ [Parameter (ValueFromPipeline , Mandatory = $true )]
8
+ $InputObject
5
9
)
6
10
7
- Begin { $d = @ () }
8
- Process { $d += $data }
11
+ Begin { $objectsToWrite = @ () }
12
+ Process { $objectsToWrite += $InputObject }
9
13
End {
10
- $target = " @`"`r`n {0}`r`n`" @" -f ($d | out-string ).Trim()
11
- $pseditor .GetEditorContext ().currentfile.inserttext( $target )
14
+ $outputString = " @`"`r`n {0}`r`n`" @" -f ($objectsToWrite | out-string ).Trim()
15
+ $psEditor .GetEditorContext ().CurrentFile.InsertText( $outputString )
12
16
}
13
- }
17
+ }
Original file line number Diff line number Diff line change
1
+ ---
2
+ external help file : PowerShellEditorServices.Commands-help.xml
3
+ online version : https://github.com/PowerShell/PowerShellEditorServices/tree/master/module/docs/Out-CurrentFile.md
4
+ schema : 2.0.0
5
+ ---
6
+
7
+ # Out-CurrentFile
8
+
9
+ ## SYNOPSIS
10
+
11
+ Sends the output through Out-String to the current open editor file.
12
+
13
+ ## SYNTAX
14
+
15
+ ``` powershell
16
+ Out-CurrentFile [-InputObject] <Object>
17
+ ```
18
+
19
+ ## DESCRIPTION
20
+
21
+ The Out-CurrentFile cmdlet sends output through Out-String to the current open
22
+ editor file.
23
+
24
+ ## EXAMPLES
25
+
26
+ ### Example 1
27
+
28
+ ``` powershell
29
+ Get-Process | Out-CurrentFile
30
+ ```
31
+
32
+ Runs the ` Get-Process ` command and formats its output into the current
33
+ editor file.
34
+
35
+ ## PARAMETERS
36
+
37
+ ### -InputObject
38
+
39
+ The input object to format, either as a parameter or from the pipeline.
40
+
41
+ ``` yaml
42
+ Type : Object
43
+ Parameter Sets : (All)
44
+ Aliases :
45
+
46
+ Required : True
47
+ Position : 0
48
+ Default value : None
49
+ Accept pipeline input : True (ByValue)
50
+ Accept wildcard characters : False
51
+ ` ` `
52
+
53
+ ## INPUTS
54
+
55
+ ### System.Object
56
+
57
+ ## OUTPUTS
58
+
59
+ ### System.Object
60
+
61
+ ## NOTES
62
+
63
+ ## RELATED LINKS
Original file line number Diff line number Diff line change @@ -33,6 +33,10 @@ public interface IEditorOperations
33
33
/// <returns>The resolved file path.</returns>
34
34
string GetWorkspaceRelativePath ( string filePath ) ;
35
35
36
+ /// <summary>
37
+ /// Causes a new untitled file to be created in the editor.
38
+ /// </summary>
39
+ /// <returns>A task that can be awaited for completion.</returns>
36
40
Task NewFile ( ) ;
37
41
38
42
/// <summary>
You can’t perform that action at this time.
0 commit comments