Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed Sep 15, 2018
1 parent 30303ba commit 5d7f6fb
Show file tree
Hide file tree
Showing 19 changed files with 414 additions and 278 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
v1.1.0
Cleaned up ToDo code (Issue #12)
Updated README
Help cleanup

v1.0.1
fixed version number mistake
Expand Down
33 changes: 23 additions & 10 deletions docs/Add-Border.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,33 @@ schema: 2.0.0
# Add-Border

## SYNOPSIS

Create a text border around a string.

## SYNTAX

### single (Default)
```

```yaml
Add-Border [-Text] <String> [-Character <String>] [-InsertBlanks] [-Tab <Int32>] [<CommonParameters>]
```

### block
```

```yaml
Add-Border [-TextBlock] <String[]> [-Character <String>] [-InsertBlanks] [-Tab <Int32>] [<CommonParameters>]
```

## DESCRIPTION

This command will create a character or text based border around a line of text.
You might use this to create a formatted text report or to improve the display of information to the screen.

## EXAMPLES

### EXAMPLE 1
```

```powershell
PS C:\> add-border "PowerShell Wins!"
********************
Expand All @@ -38,7 +43,8 @@ PS C:\> add-border "PowerShell Wins!"
```

### EXAMPLE 2
```

```powershell
PS C:\> add-border "PowerShell Wins!" -tab 1
********************
Expand All @@ -49,7 +55,8 @@ PS C:\> add-border "PowerShell Wins!" -tab 1
Note that this EXAMPLE may not format properly in the console.

### EXAMPLE 3
```

```powershell
PS C:\> add-border "PowerShell Wins!" -character "-" -insertBlanks
--------------------
Expand All @@ -60,7 +67,8 @@ PS C:\> add-border "PowerShell Wins!" -character "-" -insertBlanks
```

### EXAMPLE 4
```

```powershell
PS C:\> add-border -textblock (get-service win* | out-string).trim()
**********************************************************************
Expand All @@ -78,6 +86,7 @@ Create a border around the output of a Get-Service command.
## PARAMETERS

### -Text

A single line of text that will be wrapped in a border.

```yaml
Expand All @@ -93,8 +102,8 @@ Accept wildcard characters: False
```
### -TextBlock
A multiline block of text.
You might want to trim blank lines from the beginning, end or both.
A multiline block of text. You might want to trim blank lines from the beginning, end or both.
```yaml
Type: String[]
Expand All @@ -109,6 +118,7 @@ Accept wildcard characters: False
```
### -Character
The character to use for the border. It must be a single character.
```yaml
Expand All @@ -124,6 +134,7 @@ Accept wildcard characters: False
```
### -InsertBlanks
Insert blank lines before and after the text. The default behavior is to create a border box close to the text. See examples.
```yaml
Expand All @@ -139,7 +150,8 @@ Accept wildcard characters: False
```
### -Tab
insert X number of tabs
Insert X number of tabs.
```yaml
Type: Int32
Expand All @@ -154,6 +166,7 @@ Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
Expand All @@ -165,7 +178,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
### System.String
## NOTES
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
## RELATED LINKS
20 changes: 16 additions & 4 deletions docs/Copy-Command.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,43 @@ schema: 2.0.0
# Copy-Command

## SYNOPSIS

Copy a PowerShell command.

## SYNTAX

```
```yaml
Copy-Command [-Command] <String> [[-NewName] <String>] [-IncludeDynamic] [-AsProxy] [-UseForwardHelp]
[<CommonParameters>]
```

## DESCRIPTION

This command will copy a PowerShell command, including parameters and help to a new user-specified command. You can use this to create a "wrapper" function or to easily create a proxy function. The default behavior is to create a copy of the command complete with the original comment-based help block.

For best results, run this in the PowerShell ISE of Visual Studio code, the copied command will be opened in a new tab or file.

## EXAMPLES

### EXAMPLE 1
```

```powershell
PS C:\> Copy-Command Get-Process Get-MyProcess
```

Create a copy of Get-Process called Get-MyProcess.

### EXAMPLE 2
```

```powershell
PS C:\> Copy-Command Get-Eventlog -asproxy -useforwardhelp
```

Create a proxy function for Get-Eventlog and use forwarded help links.

### EXAMPLE 3
```

```powershell
PS C:\> Copy-Command Get-ADComputer Get-MyADComputer -includedynamic
```

Expand All @@ -48,6 +53,7 @@ Create a wrapper function for Get-ADComputer called Get-MyADComputer. Due to the
## PARAMETERS

### -Command

The name of a PowerShell command, preferably a cmdlet but that is not a requirement. You can specify an alias and it will be resolved.

```yaml
Expand All @@ -63,6 +69,7 @@ Accept wildcard characters: False
```
### -NewName
Specify a name for your copy of the command. If no new name is specified, the original name will be used.
```yaml
Expand All @@ -78,6 +85,7 @@ Accept wildcard characters: False
```
### -IncludeDynamic
The command will only copy explicitly defined parameters unless you specify to include any dynamic parameters as well. If you copy a command and it seems to be missing parameters, re-copy and include dynamic parameters.
```yaml
Expand All @@ -93,6 +101,7 @@ Accept wildcard characters: False
```
### -AsProxy
Create a traditional proxy function.
```yaml
Expand All @@ -108,6 +117,7 @@ Accept wildcard characters: False
```
### -UseForwardHelp
By default the copy process will create a comment-based help block with the original command's help which you can then edit to meet your requirements. Or you can opt to retain the forwarded help links to the original command.
```yaml
Expand All @@ -123,6 +133,7 @@ Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
Expand All @@ -134,6 +145,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
### [system.string[]]
## NOTES
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
## RELATED LINKS
Expand Down
24 changes: 18 additions & 6 deletions docs/Format-Percent.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,32 @@ schema: 2.0.0
# Format-Percent

## SYNOPSIS

Format a value as a percentage.

## SYNTAX

### None (Default)
```

```yaml
Format-Percent [-Value] <Object> [-Total] <Object> [-Decimal <Int32>] [<CommonParameters>]
```

### String
```

```yaml
Format-Percent [-Value] <Object> [-Total] <Object> [-Decimal <Int32>] [-AsString] [<CommonParameters>]
```

## DESCRIPTION

This command calculates a percentage of a value from a total, with the formula (value/total)*100. The default is to return a value to 2 decimal places but you can configure that with -Decimal. There is also an option to format the percentage as a string which will include the % symbol.

## EXAMPLES

### EXAMPLE 1
```

```powershell
PS C:\> Format-Percent -value 1234.567 -total 5000 -decimal 4
24.6913
Expand All @@ -37,7 +42,8 @@ PS C:\> Format-Percent -value 1234.567 -total 5000 -decimal 4
Calculate a percentage from 1234.567 out of 5000 (i.e. 1234.567/5000) to 4 decimal points.

### EXAMPLE 2
```

```powershell
PS C:\> get-ciminstance win32_operatingsystem -computer chi-dc04 | select PSComputername,TotalVisibleMemorySize,@{Name="PctFreeMem";Expression={ Format-Percent $_.FreePhysicalMemory $_.TotalVisibleMemorySize}}
PSComputerName TotalVisibleMemorySize PctFreeMem
Expand All @@ -46,7 +52,8 @@ chi-dc04 1738292 23.92
```

### EXAMPLE 3
```

```powershell
PS C:\> get-ciminstance win32_operatingsystem -computer chi-dc04 | select PSComputername,TotalVisibleMemorySize,@{Name="PctFreeMem";Expression={ Format-Percent $_.FreePhysicalMemory $_.TotalVisibleMemorySize -asString}}
PSComputerName TotalVisibleMemorySize PctFreeMem
Expand All @@ -57,6 +64,7 @@ chi-dc04 1738292 23.92%
## PARAMETERS

### -Value

The numerator value.

```yaml
Expand All @@ -72,6 +80,7 @@ Accept wildcard characters: False
```
### -Total
The denominator value.
```yaml
Expand All @@ -87,6 +96,7 @@ Accept wildcard characters: False
```
### -Decimal
The number of decimal places to return between 0 and 15.
```yaml
Expand All @@ -102,6 +112,7 @@ Accept wildcard characters: False
```
### -AsString
Write the result as a string.
```yaml
Expand All @@ -117,6 +128,7 @@ Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
Expand All @@ -130,11 +142,11 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
### System.String
## NOTES
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
## RELATED LINKS
[Format-Value]()
[Format-String]()
Loading

0 comments on commit 5d7f6fb

Please sign in to comment.