Skip to content

Commit

Permalink
v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed Apr 19, 2023
1 parent 3e80c92 commit e12b2c1
Show file tree
Hide file tree
Showing 35 changed files with 606 additions and 545 deletions.
8 changes: 4 additions & 4 deletions PSFunctionTools.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

@{
RootModule = 'PSFunctionTools.psm1'
ModuleVersion = '1.1.0'
ModuleVersion = '1.2.0'
CompatiblePSEditions = 'Core'
GUID = '151466e0-a952-4b6a-ad81-40dafc9ef9bb'
Author = 'Jeff Hicks'
CompanyName = 'JDH Information Technology Solutions, Inc.'
Copyright = '(c) 2021-2023 JDH Information Technology Solutions, Inc.'
Description = 'A set of PowerShell commands for managing and automating PowerShell scripts, functions, and modules.'
Description = 'A set of PowerShell 7 commands for managing and automating PowerShell scripts, functions, and modules. You can use these tools to accelerate PowerShell script development.'
PowerShellVersion = '7.1'
# TypesToProcess = @()
FormatsToProcess = @('formats\modulelayout.format.ps1xml',
Expand All @@ -25,7 +25,8 @@
'Get-PSRequirements', 'New-CommentHelp', 'Format-FunctionName',
'Get-ModuleLayout', 'Get-ParameterBlock', 'Get-FunctionAttribute',
'Get-FunctionProfile', 'New-ModuleFromFiles', 'New-ModuleFromLayout',
'Get-PSFunctionTools','Export-FunctionToFile')
'Get-PSFunctionTools','Export-FunctionToFile'
)
CmdletsToExport = @()
# VariablesToExport = @()
AliasesToExport = @('gfal', 'ga', 'eff', 'eml', 'iml', 'csf', 'gpb',
Expand All @@ -44,4 +45,3 @@
} # End of PSData hashtable
} # End of PrivateData hashtable
}

3 changes: 1 addition & 2 deletions PSFunctionTools.psm1
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

Get-Childitem $PSScriptRoot\functions\*.ps1 -recurse |
Get-ChildItem $PSScriptRoot\functions\*.ps1 -recurse |
Foreach-Object {
. $_.FullName
}

18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To see a summary of these commands at any time, run [Get-PSFunctionTools](docs/G
```dos
PS C:\> Get-PSFunctionTools
Module: PSFunctionTools [v1.0.0]
Module: PSFunctionTools [v1.2.0]
Name Alias Synopsis
---- ----- --------
Expand All @@ -43,7 +43,7 @@ Get-PSRequirements List PowerShell command requirements.
Import-ModuleLayout iml Create a module structure from a layout fil…
New-CommentHelp nch Create comment based help.
New-ModuleFromFiles Create a PowerShell module from a set of fi…
New-ModuleFromLayout Creat a new module based on a layout.
New-ModuleFromLayout Create a new module based on a layout.
Test-FunctionName tfn Test the validity of a PowerShell function …
```

Expand Down Expand Up @@ -124,7 +124,7 @@ Test-Data

### [Get-FunctionAlias](docs/Get-FunctionAlias.md)

`Get-FunctionAlias` is a tool you can use in your scripting automation. It will extract function names and aliases from a PowerShell script file. The source must be a .ps1 or .psm1 file. The command will only idenfity aliases defined as part of the function using code like `[alias('foo')]`.
`Get-FunctionAlias` is a tool you can use in your scripting automation. It will extract function names and aliases from a PowerShell script file. The source must be a .ps1 or .psm1 file. The command will only identify aliases defined as part of the function using code like `[alias('foo')]`.

```dos
PS C:\> Get-FunctionAlias -Path C:\scripts\SQLBackup.psm1
Expand Down Expand Up @@ -221,7 +221,7 @@ Attributes Parameters Extent
---------- ---------- ------
{} {$Path, $Cutoff, $Filter} Param (…
PS C:\> Get-Parameterblock -path c:\scripts\SimpleFunction.ps1 -name Get-FolderData -ToString
PS C:\> Get-ParameterBlock -path c:\scripts\SimpleFunction.ps1 -name Get-FolderData -ToString
[parameter(HelpMessage = "Specify the folder to analyze")]
[string]$Path="."
[datetime]$Cutoff
Expand Down Expand Up @@ -446,3 +446,13 @@ You are welcome to copy, paste, and edit these samples as much as you would like
## Bugs and Enhancements

Please use the repository's Issues section for reporting bugs and requesting new features. Remember, the commands in this module are designed for PowerShell 7.1 and later.

## Related Commands and Projects

You might also be interested in the [PSScriptTools](https://github.com/jdhitsolutions/PSScriptTools) module. This module has several commands that you might use in your toolmaking.

+ [New-PSFormatXML](http://bit.ly/31SGo5o)
+ [New-PSDynamicParameterForm](https://bit.ly/3HNNcpU)
+ [New-PSDynamicParameter](https://bit.ly/3JX8R0w)

Use the commands in the [PSTypeExtensionTools](https://github.com/jdhitsolutions/PSTypeExtensionTools) to extend standard types as well as custom types and classes in your work.
17 changes: 17 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog for PSFunctionTools

## v1.2.0

### Changed

- Pester test revisions.
- Modified `Format-FunctionName` to let you capitalize N number of characters in the Noun portion of your command name.
- Help updates.
- Updated `README.md`.

### Added

- Added missing online help links.

### Removed

- Deleted unused `Types` folder.

## v1.1.0

### Changed
Expand Down
6 changes: 3 additions & 3 deletions docs/Export-FunctionToFile.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSFunctionTools-help.xml
Module Name: PSFunctionTools
online version:
online version: https://bit.ly/3mI7E6w
schema: 2.0.0
---

Expand All @@ -19,7 +19,7 @@ Export-FunctionToFile [-Name] <String> [-Path <String>] [-PassThru] [-Requires <

## DESCRIPTION

You can use this command to export a function which is loaded into your PowerShell session. You might need to do this when you create an ad-hoc function and want to save it to a file. This command will take the content of the function and export it to a ps1 file. The function name will be used for the file name. Although, characters like the colon will be stripped to create a filesystem-compatibale filename.
You can use this command to export a function which is loaded into your PowerShell session. You might need to do this when you create an ad-hoc function and want to save it to a file. This command will take the content of the function and export it to a ps1 file. The function name will be used for the file name. Although, characters like the colon will be stripped to create a filesystem-compatible filename.

## EXAMPLES

Expand Down Expand Up @@ -113,7 +113,7 @@ Accept wildcard characters: False
### -Requires
Specify #Requires statements, including the #
Specify #Requires statements, including the # character.
```yaml
Type: String[]
Expand Down
33 changes: 29 additions & 4 deletions docs/Format-FunctionName.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ Format a function name to proper case.
## SYNTAX

```yaml
Format-FunctionName [[-Name] <String>] [<CommonParameters>]
Format-FunctionName [-Name] <String> [-NounCapitals <Int32>] [<CommonParameters>]
```

## DESCRIPTION

Format-FunctionName is intended to be used as a helper function in your scripting automation. This is a simple function that will format a verb-noun function name into proper case. It will take an input such as test-data and format it as Test-Data. It will not format as PascalCase. The command also will not verify that the verb component is acceptable. Use Test-FunctionName for that process.
Format-FunctionName is intended to be used as a helper function in your scripting automation. This is a simple function that will format a verb-noun function name into proper case. It will take an input such as test-data and format it as Test-Data. It will not format as Pascal case, although you can capitalize N number of characters in the Noun portion of your command name. The command also will not verify that the verb component is acceptable. Use Test-FunctionName for that process.

## EXAMPLES

Expand All @@ -39,7 +39,16 @@ PS C:\> Format-FunctionName try-pssystem
Try-Pssystem
```

The command does not validate the verb nor can it produce a PascalCase result like Try-PsSystem.
The command does not validate the verb nor can it produce a Pascal Case result like Try-PsSystem.

### Example 3

```powershell
PS C:\> Format-FunctionName test-pssystem -NounCapitals 3
Test-PSSystem
```

Even though you can't format in Pascal case, you can specify how many characters of the Noun portion of your command that you want to capitalize.

## PARAMETERS

Expand All @@ -55,7 +64,23 @@ Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: byValue
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```
### -NounCapitals
Capitalize the first N number of characters in the Noun.
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
Expand Down
2 changes: 1 addition & 1 deletion docs/Get-FunctionAlias.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Get-FunctionAlias [-Path] <String> [<CommonParameters>]

## DESCRIPTION

Get-FunctionAlias is a tool you can use in your scripting automation. It will extract function names and aliases from a PowerShell script file. The source must be a .ps1 or .psm1 file. The command will only idenfity aliases defined as part of the function using code like [alias('foo')].
Get-FunctionAlias is a tool you can use in your scripting automation. It will extract function names and aliases from a PowerShell script file. The source must be a .ps1 or .psm1 file. The command will only identify aliases defined as part of the function using code like [alias('foo')].

## EXAMPLES

Expand Down
8 changes: 4 additions & 4 deletions docs/Get-FunctionAttribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,28 @@ This command can be used to get function attributes such as cmdletbinding or ali
### Example 1

```powershell
PS C:\> Get-Functionattribute -path c:\scripts\Get-ParameterBlock.ps1 -Name get-parameterblock
PS C:\> Get-FunctionAttribute -path c:\scripts\Get-ParameterBlock.ps1 -Name Get-ParameterBlock
Type : cmdletbinding
NamedArguments : {}
PositionalArguments : {}
String : [cmdletbinding()]
Function : Get-Parameterblock
Function : Get-ParameterBlock
Path : C:\scripts\Get-ParameterBlock.ps1
Type : alias
NamedArguments : {}
PositionalArguments : {"gpb"}
String : [alias("gpb")]
Function : Get-Parameterblock
Function : Get-ParameterBlock
Path : C:\scripts\Get-ParameterBlock.ps1
Type : OutputType
NamedArguments : {}
PositionalArguments : {"ParamBlockAst", "String"}
String : [OutputType("ParamBlockAst","String")]
Function : Get-Parameterblock
Function : Get-ParameterBlock
Path : C:\scripts\PSFunctionTools\functions\public\Get-ParameterB
lock.ps1
```
Expand Down
3 changes: 2 additions & 1 deletion docs/Get-FunctionName.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Get-FunctionName [-Path] <String> [-All] [-Detailed] [<CommonParameters>]

## DESCRIPTION

When exporting functions from files, you may only want to export specific functions. Which you can do if you know the name. Use Get-FunctionName to identify the names of functions. The default behavior is to get names of functions that follow the verb-noun naming convention.
When exporting functions from files, you may only want to export specific functions. Which you can do if you know the name. Use Get-FunctionName to identify the names of functions. The default behavior is to get names of functions that follow the Verb-Noun naming convention.

## EXAMPLES

Expand Down Expand Up @@ -129,6 +129,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 Down
2 changes: 1 addition & 1 deletion docs/Get-ModuleLayout.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Get-ModuleLayout [-Path] <String> [-AsTree] [<CommonParameters>]

## DESCRIPTION

This command will provide information about a module layout folder which was created using Export-ModuleLayout. The default output is custom object. You can elect to view the layout as a tree. This parameter requires the tree commandline utility which should be available on Windows systems by default. On non-Windows platforms, you may need to install the utility.
This command will provide information about a module layout folder which was created using Export-ModuleLayout. The default output is custom object. You can elect to view the layout as a tree. This parameter requires the tree command-line utility which should be available on Windows systems by default. On non-Windows platforms, you may need to install the utility.

## EXAMPLES

Expand Down
14 changes: 8 additions & 6 deletions docs/Get-PSFunctionTools.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,30 @@ This command will give you a brief summary of all commands, including aliases, i
### Example 1

```powershell
PS C:\> PS C:\Scripts\PSFunctionTools> Get-PSFunctionTools
PS C:\> Get-PSFunctionTools
Module: PSFunctionTools [v0.6.0]
Module: PSFunctionTools [v1.2.0]
Name Alias Synopsis
---- ----- --------
Convert-ScriptToFunction csf Convert a script file to a PowerShell funct…
Export-FunctionFromFile eff Export a PowerShell function from a script …
Export-FunctionToFile etf Export a PowerShell function to a file.
Export-ModuleLayout eml Export a model module layout.
Format-FunctionName Format a function name to proper case.
Format-FunctionName ffn Format a function name to proper case.
Get-FunctionAlias {ga, gfal} Get a defined function alias.
Get-FunctionAttribute gfa Get function attributes like cmdletbinding.
Get-FunctionName Identify the names of PowerShell functions …
Get-FunctionName gfn Identify the names of PowerShell functions …
Get-FunctionProfile gfp Get a technical summary of a PowerShell fun…
Get-ModuleLayout Get information about a module layout file.
Get-ParameterBlock gpb Get a function's parameter block.
Get-PSFunctionTools Get a summary of PSFunctionTools commands.
Get-PSRequirements List PowerShell command requirements.
Import-ModuleLayout iml Create a module structure from a layout fil…
New-CommentHelp nch Create comment based help.
New-ModuleFromFiles Create a PowerShell module from a set of fi…
New-ModuleFromLayout Creat a new module based on a layout.
Test-FunctionName Test the validity of a PowerShell function …
New-ModuleFromLayout Create a new module based on a layout.
Test-FunctionName tfn Test the validity of a PowerShell function …
```

The default output is formatted as a table.
Expand Down
4 changes: 2 additions & 2 deletions docs/Get-ParameterBlock.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This command is designed to use the PowerShell AST and retrieve a function's par
### Example 1

```powershell
PS C:\Scripts> Get-parameterblock -path c:\scripts\SimpleFunction.ps1 -name Get-FolderData
PS C:\> Get-ParameterBlock -path c:\scripts\SimpleFunction.ps1 -name Get-FolderData
Attributes Parameters Extent
---------- ---------- ------
Expand All @@ -38,7 +38,7 @@ Get the AST parameter block object.
### Example 2

```powershell
PS C:\Scripts> Get-parameterblock -path c:\scripts\SimpleFunction.ps1 -name Get-FolderData -ToString
PS C:\> Get-ParameterBlock -path c:\scripts\SimpleFunction.ps1 -name Get-FolderData -ToString
[parameter(HelpMessage = "Specify the folder to analyze")]
[string]$Path="."
[datetime]$Cutoff
Expand Down
2 changes: 1 addition & 1 deletion docs/New-CommentHelp.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ You can also specify a synopsis and/or description. Otherwise, you can edit the
### Example 1

```powershell
PS C:\> Get-Parameterblock -path c:\scripts\SimpleFunction.ps1 -name Get-FolderData | New-CommentHelp -Synopsis "Get folder details"
PS C:\> Get-ParameterBlock -path c:\scripts\SimpleFunction.ps1 -name Get-FolderData | New-CommentHelp -Synopsis "Get folder details"
<#
.Synopsis
Get folder details
Expand Down
2 changes: 1 addition & 1 deletion docs/New-ModuleFromFiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ PS C:\> $splat = @{
PS C:\> New-ModuleFromFiles @splat
```

Using the parameter values defined in the hashtable, create a new module called PSTools using the functions from pstools.psm1 and servertools.ps1. Only functions with valid verb-noun names will be exported. This example will also create initial help documentation and initialize a git repository.
Using the parameter values defined in the hashtable, create a new module called PSTools using the functions from pstools.psm1 and servertools.ps1. Only functions with valid verb-noun names will be exported. This example will also create the initial help documentation and initialize a git repository.

## PARAMETERS

Expand Down
2 changes: 1 addition & 1 deletion docs/New-ModuleFromLayout.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ schema: 2.0.0

## SYNOPSIS

Creat a new module based on a layout.
Create a new module based on a layout.

## SYNTAX

Expand Down
Loading

0 comments on commit e12b2c1

Please sign in to comment.