Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Powershell by jinxiao #19

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Makefile_Windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
BINDIR = C:\tools

install: ## Install Target
go build -o ${BINDIR}/awsd/awsd_prompt
cp scripts/powrshell/awsd.ps1 ${BINDIR}/awsd/awsd.ps1
New-Item ~/.awsd

uninstall: ## Uninstall Target
rm -Force ${BINDIR}/awsd
24 changes: 24 additions & 0 deletions scripts/powershell/awsd.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# check if $1 is empty
if (-not $args)
{
# no argument passed
Set-Variable -Name "AWS_PROFILE" -Value "$env:AWS_PROFILE"
awsd_prompt
}
else
{
# argument passed, assume it's a profile name
Set-Variable -Name "AWS_PROFILE" -Value "$env:AWS_PROFILE"
awsd_prompt $args
}

$selected_profile = Get-Content "$env:USERPROFILE\.awsd"

if (-not $selected_profile)
{
$env:AWS_PROFILE = $null
}
else
{
$env:AWS_PROFILE = $selected_profile
}