Skip to content

Commit

Permalink
Added GUID to template
Browse files Browse the repository at this point in the history
  • Loading branch information
dfinke committed Mar 5, 2017
1 parent ab8752a commit 39a192e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion NameIT.psd1
Expand Up @@ -4,7 +4,7 @@
RootModule = 'NameIT.psm1'

# Version number of this module.
ModuleVersion = '1.8.0'
ModuleVersion = '1.8.2'

# ID used to uniquely identify this module
GUID = '6d4ec85a-e09f-4024-819d-66bafa130a5b'
Expand Down
15 changes: 14 additions & 1 deletion NameIT.psm1
Expand Up @@ -91,7 +91,7 @@ function Invoke-Generate {
$script:alphabet = $alphabet
$script:numbers = $number

$functionList = 'alpha|synonym|numeric|syllable|vowel|phoneticvowel|consonant|person|address|space|noun|adjective|verb|cmdlet|state|dave'.Split('|')
$functionList = 'alpha|synonym|numeric|syllable|vowel|phoneticvowel|consonant|person|address|space|noun|adjective|verb|cmdlet|state|dave|guid'.Split('|')

$customDataFile="$PSScriptRoot\customData\customData.ps1"
if(Test-Path $customDataFile){
Expand Down Expand Up @@ -477,6 +477,19 @@ function Dave {
$daves | get-random
}

function guid {
param(
$part
)

$guid=[guid]::NewGuid().guid

if($part -ne $null) {
($guid -split '-')[$part]
} else {
$guid
}
}

Set-Alias ig Invoke-Generate

Expand Down
15 changes: 15 additions & 0 deletions README.md
Expand Up @@ -10,6 +10,21 @@ This project is a port of https://github.com/mitchdenny/namerer. Hat tip to [Mit

![image1](https://github.com/dfinke/NameIT/blob/master/images/nameitAddressVerbNounAdjective.gif?raw=true)

## Release 1.8.2 : 03/5/2017
Added `guid` to the template. *Chris Hunt* suggested and then delegated the implementation to me after I showed him I was randomly generating guid parts.

```powershell
Invoke-Generate "[guid]"
Invoke-Generate "[guid 0]"
Invoke-Generate "[guid 3]"
```

```
690dcb11-a5b5-462a-a860-8de11626f5fd
eeb507b0
9873
```

## Release 1.7.0 : 10/3/2016
* Generate random cmdlet names (verb-noun) and limit it to approved verbs

Expand Down
9 changes: 8 additions & 1 deletion demo.txt
Expand Up @@ -13,4 +13,11 @@ Invoke-Generate "cafe_[syllable][syllable]" -count 3
Invoke-Generate "[synonym cafe]_[syllable][syllable]" -count 5
Invoke-Generate "[person]" -count 3
Invoke-Generate "[person female]" -count 5
Invoke-Generate "[person male]" -count 5
Invoke-Generate "[person male]" -count 5

Invoke-Generate "[guid]"
Invoke-Generate "[guid 0]"
Invoke-Generate "[guid 1]"
Invoke-Generate "[guid 2]"
Invoke-Generate "[guid 3]"
Invoke-Generate "[guid 4]"

0 comments on commit 39a192e

Please sign in to comment.