The codemelted.ps1
script will provide a Command Line Interface (CLI) to facilitate common developer use cases on Mac, Linux, or Windows systems. When installed, the CLI will provide the codemelted
command that can be accessed in a pwsh terminal or in ps1
scripts that facilitate a set of automated tasks. A developer may also build a Terminal User Interface (TUI) for a text based user interface.
LAST UPDATED: 2025-01-08
Hope you enjoy the content. Any support is greatly appreciated. Thank you! 🙇
Table of Contents
The following section walk you through the installation of the pwsh terminal. Once installed you can access the terminal via the pwsh
command.
From a Mac OS terminal execute the command:
brew install --cask powershell
Follow the Install Powershell on Linux to properly setup the pwsh terminal for your Linux flavor.
From a windows cmd terminal execute the command
winget install --id Microsoft.PowerShell --source winget
The following series of commands will setup a pwsh terminal on a Raspberry Pi picking up the necessary repo and setting up the environment. Notice the v7.4.6
as the currently identified version. Change this to install the latest version.
dpkg --add-architecture arm64
apt-get update
apt-get install -y libc6:arm64 libstdc++6:arm64
mkdir -p /opt/microsoft/powershell/7
wget -O /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell-7.4.6-linux-arm64.tar.gz
tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7
chmod +x /opt/microsoft/powershell/7/pwsh
ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh
rm /tmp/powershell.tar.gz
pwsh --version
To find the current version published in the PSGallery execute:
Find-Script -Name codemelted
To install the codemelted CLI from the PS Gallery execute:
Install-Script -Name codemelted
To update to the latest version of the codemelted CLI from the PS Gallery execute:
Update-Script -Name codemelted
To completely uninstall the codemelted CLI execute:
Uninstall-Script -Name codemelted
On Mac OS in the zsh terminal, the $env:PSModulePath
does not include the Scripts/
path where the Install-Script
installs the codemelted.ps1
script file. To fix this issue, add the following entry to your .zshrc
file.
export PWSH_SCRIPT_INSTALL="$HOME/.local/share/powershell/Scripts:/usr/local/share/powershell/Scripts:/usr/local/microsoft/powershell/7/Scripts"
# Make sure on this to not eliminate any other script settings.
export PATH="$PWSH_SCRIPT_INSTALL:$PATH"
No issues when running the Install-Script
cmdlet.
The following sub-sections break down how to drill into the codemelted CLI help system. It utilizes the PowerShell Help system tailored to the codemelted CLI needs.
codemelted --about
will tell you what version of the codemelted CLI module is installed. The output will be as follows:
Name Version Author Description
---- ------- ------ -----------
codemelted 0.1.0.0 [email protected] A CLI to facilitate common developer use cases on Mac, Linux, or Windows systems.
To check for the latest version of the script execute Update-Script -Name codemelted
in a pwsh
terminal window.
codemelted --help
will produce the following STDOUT from the PowerShell Get-Help
system. From the help output, you can drill into the help system of each [Action]
to learn about each of the supported use case actions.
NAME
help
SYNOPSIS
The codemelted Command Line Interface (CLI) Terminal Module. It allows
a developer to execute the CodeMelted DEV | Module use cases within a
pwsh terminal shell. This allows for building CLI tools, Terminal User
Interface (TUI) tools, or building DevOps toolchain automation.
SYNTAX:
codemelted [Action] [Params]
PARAMETERS:
[Action]
# To Learn About the CLI use cases.
--about : Get current information about the codemelted CLI
--help : Execute 'codemelted --help @{ "action" = [Use Case] }'
to learn more about the CLI Actions.
# JSON Use Cases
--as-bool
--as-int
--as-double
--check-has-property
--check-type
--check-valid-url
--create-array
--create-object
--parse-json
--stringify-json
--try-has-property"
--try-type
--try-valid-url
[Params]
The optional set of named arguments wrapped within a [hashtable]
SYNTAX
help [[-Params] <Hashtable>] [<CommonParameters>]
DESCRIPTION
RELATED LINKS
CodeMelted | DEV Modules:
https://developer.codemelted.com
GitHub Source:
https://github.com/CodeMelted/codemelted_developer/tree/main/terminal
TBD
MIT License
© 2024 Mark Shaffer
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.