From 39a192e5916614495cd524c0d59ebd0704e52510 Mon Sep 17 00:00:00 2001 From: dfinke Date: Sun, 5 Mar 2017 12:34:52 -0500 Subject: [PATCH] Added GUID to template --- NameIT.psd1 | 2 +- NameIT.psm1 | 15 ++++++++++++++- README.md | 15 +++++++++++++++ demo.txt | 9 ++++++++- 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/NameIT.psd1 b/NameIT.psd1 index 4f7a89c..2ab910b 100644 --- a/NameIT.psd1 +++ b/NameIT.psd1 @@ -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' diff --git a/NameIT.psm1 b/NameIT.psm1 index 3d803bf..ee444c3 100644 --- a/NameIT.psm1 +++ b/NameIT.psm1 @@ -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){ @@ -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 diff --git a/README.md b/README.md index a0a0d15..9bd386b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/demo.txt b/demo.txt index 850d5a4..2cdad4b 100644 --- a/demo.txt +++ b/demo.txt @@ -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 \ No newline at end of file +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]"