Skip to content

Commit a33e532

Browse files
refractor
1 parent 24b1367 commit a33e532

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

attach-with.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
AliasesToExport = '*'
4646

4747
# Functions to export from this module
48-
FunctionsToExport = @('Invoke-With', 'Write-WithPrompt')
48+
FunctionsToExport = @('Start-With', 'Write-WithPrompt')
4949

5050
# Private data to pass to the module specified in RootModule. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
5151
PrivateData = @{

attach-with.psm1

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function Remove-With()
1+
function Erase-With()
22
{
33
param(
44
[string]
@@ -42,20 +42,23 @@ function Move-With()
4242
elseif ($input_shell.StartsWith($command)) {
4343

4444
Write-Host "  Your primary command is '$command'." -ForegroundColor DarkRed
45-
Write-Host "When using with, make sure to not duplicate the command." -ForegroundColor DarkRed
45+
Write-Host "Make sure to not duplicate the command." -ForegroundColor DarkRed
4646
}
4747
elseif ($input_shell.StartsWith('>'))
4848
{
4949
$addition = $input_shell.Substring(1).Trim()
50+
5051
if (!($addition -eq ''))
5152
{
5253
$command += " $($input_shell.Substring(1).Trim())"
5354
}
5455
}
56+
5557
elseif ($input_shell.StartsWith('<'))
5658
{
57-
$command = Remove-With -command $command
59+
$command = Erase-With -command $command
5860
}
61+
5962
else
6063
{
6164
Invoke-Expression "$command $input_shell"
@@ -105,7 +108,7 @@ function Write-ClassicPrompt()
105108
Write-Host "" -NoNewline
106109
}
107110

108-
function Invoke-With()
111+
function Start-With()
109112
{
110113
$command = $args
111114
if (Validate-Command -command $command[0])
@@ -127,5 +130,4 @@ function Validate-Command()
127130
return [bool](Get-Command -Name $command -ErrorAction SilentlyContinue)
128131
}
129132

130-
Set-Alias attach Invoke-With
131-
133+
Set-Alias attach Start-With

0 commit comments

Comments
 (0)