Skip to content

Instantly share code, notes, and snippets.

@codbugs
Last active February 16, 2022 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codbugs/3e3abe4c7709e992c819327cb0b9c0c0 to your computer and use it in GitHub Desktop.
Save codbugs/3e3abe4c7709e992c819327cb0b9c0c0 to your computer and use it in GitHub Desktop.
Los ficheros de este gist han sido creados con el objetivo de incluirlos en el artículo con título "Mejora el paso de parámetros en tus scripts de PowerShell". The files in this gist have been created with the purpose of including them in the article titled "Improve how to provide parameters in your PowerShell scripts" on the Dev.To platform.

Objetivo

Los ficheros de este gist han sido creados con el objetivo de incluirlos en el artículo con título "Mejora el paso de parámetros en tus scripts de PowerShell" en la plataforma Dev.To.

Si quieres ver el artículo pincha en el siguiente enlace. Si quieres ver el listado de todos los artículos que he publicado pincha en el siguiente enlace.

Purpose

The files in this gist have been created with the purpose of including them in the article titled "Improve how to provide parameters in your PowerShell scripts" on the [Dev.To] (https://dev.to/) platform.

If you want to see the article click on the following link. If you want to see the list of all the articles I have published click on the following link.

We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
"version";"author_name";"author_email";"author_github";"gist_name";"gist_url"
"1.0";"Coding Bugs";"coding.bugs@outlook.com";"https://github.com/codbugs";"README.md";"https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/README.md"
"1.0";"Coding Bugs";"coding.bugs@outlook.com";"https://github.com/codbugs";"coding_bugs_configuration.csv";"https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/coding_bugs_configuration.csv"
"1.0";"Coding Bugs";"coding.bugs@outlook.com";"https://github.com/codbugs";"coding_bugs_configuration.json";"https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/coding_bugs_configuration.json"
"1.0";"Coding Bugs";"coding.bugs@outlook.com";"https://github.com/codbugs";"coding_bugs_configuration.xml";"https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/coding_bugs_configuration.xml"
"1.0";"Coding Bugs";"coding.bugs@outlook.com";"https://github.com/codbugs";"Download-CsvGistFiles.ps1";"https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/Download-CsvGistFiles.ps1"
"1.0";"Coding Bugs";"coding.bugs@outlook.com";"https://github.com/codbugs";"Download-Data.ps1";"https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/Download-Data.ps1"
"1.0";"Coding Bugs";"coding.bugs@outlook.com";"https://github.com/codbugs";"Download-JsonGistFiles.ps1";"https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/Download-JsonGistFiles.ps1"
"1.0";"Coding Bugs";"coding.bugs@outlook.com";"https://github.com/codbugs";"Download-MyGitHubProfile.ps1";"https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/Download-MyGitHubProfile.ps1"
"1.0";"Coding Bugs";"coding.bugs@outlook.com";"https://github.com/codbugs";"Download-XmlGistFiles.ps1";"https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/Download-XmlGistFiles.ps1"
{
"version": "1.0",
"author": {
"name": "Coding Bugs",
"email": "coding.bugs@outlook.com",
"github": "https://github.com/codbugs"
},
"gists": [
{ "name": "README.md", "url": "https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/README.md" },
{ "name": "coding_bugs_configuration.csv", "url": "https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/coding_bugs_configuration.csv" },
{ "name": "coding_bugs_configuration.json", "url": "https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/coding_bugs_configuration.json" },
{ "name": "coding_bugs_configuration.xml", "url": "https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/coding_bugs_configuration.xml" },
{ "name": "Download-CsvGistFiles.ps1", "url": "https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/Download-CsvGistFiles.ps1" },
{ "name": "Download-Data.ps1", "url": "https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/Download-Data.ps1" },
{ "name": "Download-JsonGistFiles.ps1", "url": "https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/Download-JsonGistFiles.ps1" },
{ "name": "Download-MyGitHubProfile.ps1", "url": "https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/Download-MyGitHubProfile.ps1" },
{ "name": "Download-XmlGistFiles.ps1", "url": "https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/Download-XmlGistFiles.ps1" }
]
}
<!-- coding_bugs_configuration.xml -->
<xml>
<version>1.0</version>
<author>
<name>Coding Bugs</name>
<email>coding.bugs@outlook.com</email>
<github>https://github.com/codbugs</github>
</author>
<gists>
<gist>
<name>README.md</name>
<url>https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/README.md</url>
</gist>
<gist>
<name>coding_bugs_configuration.csv</name>
<url>https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/coding_bugs_configuration.csv</url>
</gist>
<gist>
<name>coding_bugs_configuration.json</name>
<url>https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/coding_bugs_configuration.json</url>
</gist>
<gist>
<name>coding_bugs_configuration.xml</name>
<url>https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/coding_bugs_configuration.xml</url>
</gist>
<gist>
<name>Download-CsvGistFiles.ps1</name>
<url>https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/Download-CsvGistFiles.ps1</url>
</gist>
<gist>
<name>Download-Data.ps1</name>
<url>https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/Download-Data.ps1</url>
</gist>
<gist>
<name>Download-JsonGistFiles.ps1</name>
<url>https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/Download-JsonGistFiles.ps1</url>
</gist>
<gist>
<name>Download-MyGitHubProfile.ps1</name>
<url>https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/Download-MyGitHubProfile.ps1</url>
</gist>
<gist>
<name>Download-XmlGistFiles.ps1</name>
<url>https://gist.githubusercontent.com/codbugs/3e3abe4c7709e992c819327cb0b9c0c0/raw/67b1a5e520d0ebaac8c678a43b9dda5638a147e1/Download-XmlGistFiles.ps1</url>
</gist>
</gists>
</xml>
param(
[Parameter(Mandatory=$true)]
[String] $ConfigurationFilePath
)
# Reading the configuration file
$Configuration = Get-Content $ConfigurationFilePath
$Configuration = Import-Csv -Path $ConfigurationFilePath -Delimiter ';'
$Configuration | Foreach {
# Creating the folder to download de gists
$FolderName = $_.author_name
$Folder = New-Item -Path $FolderName -Type Directory -Force
# Downloading the gists files
.\Download-Data.ps1 -Url $_.gist_url -FilePath "$FolderName\$($_.gist_name)"
}
# .\Download-CsvGistFiles.ps1 -ConfigurationFilePath coding_bugs_configuration.csv
param(
[Parameter(Mandatory=$true)]
[String] $Url,
[Parameter(Mandatory=$true)]
[String] $FilePath
)
# Save data to the file path specified and returns the response
Invoke-WebRequest -Uri $Url -OutFile $FilePath
# .\Download-Data.ps1 -Url https://github.com/codbugs -FilePath CodingBugs_Github_Profile.html
param(
[Parameter(Mandatory=$true)]
[String] $ConfigurationFilePath
)
# Reading the configuration file
$Configuration = Get-Content $ConfigurationFilePath | ConvertFrom-Json
# Creating the folder to download de gists
$FolderName = $Configuration.author.name
$Folder = New-Item -Path $FolderName -Type Directory -Force
# Downloading the gists files
$Configuration.gists | Foreach { .\Download-Data.ps1 -Url $_.url -FilePath "$FolderName\$($_.name)" }
# .\Download-JsonGistFiles.ps1 -ConfigurationFilePath coding_bugs_configuration.json
# My GitHub profile page
$MyGitHubProfileUrl = "https://github.com/codbugs"
# Folder generation based on the current date
$FolderName = Get-Date -Format "yyyyMMdd"
$Folder = New-Item -Path $FolderName -ItemType Directory -Force
# File name
$FileName = "CodingBugsProfile.html"
# Invoking the script for downloading my GitHub profile
.\Download-Data.ps1 -Url $MyGitHubProfileUrl -FilePath "$FolderName\$FileName"
param(
[Parameter(Mandatory=$true)]
[String] $ConfigurationFilePath
)
# Reading the configuration file
[XML]$Configuration = Get-Content $ConfigurationFilePath
# Creating the folder to download de gists
$FolderName = $Configuration.xml.author.name
$Folder = New-Item -Path $FolderName -Type Directory -Force
# Downloading the gists files
$Configuration.xml.gists.gist | Foreach { .\Download-Data.ps1 -Url $_.url -FilePath "$FolderName\$($_.name)" }
# .\Download-XmlGistFiles.ps1 -ConfigurationFilePath coding_bugs_configuration.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment