File tree Expand file tree Collapse file tree 5 files changed +63
-5
lines changed
Expand file tree Collapse file tree 5 files changed +63
-5
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,7 @@ credential_process = aws-fusion okta device-auth --org-domain my.okta.com --oidc
182182## Use case of ` config-switch `
183183A special of utility script to help easily switch ` profile ` and ` region `
184184
185+ ### For Linux & Darwin (MacOS)
185186This works with 2 bash script, namely ` _awsp ` and ` _awsr `
186187> _ Using the command without the bash script will have no effect_
187188
@@ -192,6 +193,16 @@ alias awsp="source _awsp"
192193alias awsr=" source _awsr"
193194```
194195
196+ ### For Windows
197+ This works with 2 powershell script, namely ` _awsp.ps1 ` and ` _awsr.ps1 `
198+
199+ Post installing the app, create 2 aliases in ` $PROFILE ` (i.e. ` $HOME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 ` ) file.
200+ ``` ps1
201+ ## aws fusion setup
202+ Set-Alias awsp "_awsp.ps1"
203+ Set-Alias awsr "_awsr.ps1"
204+ ```
205+
195206<img src =" https://raw.githubusercontent.com/snigdhasjg/aws-fusion/main/doc/images/config-switch.png " width =" 300 " alt =" config-switch-image " />
196207
197208---
Original file line number Diff line number Diff line change 1- __version__ = '1.6.1 '
1+ __version__ = '1.6.2 '
Original file line number Diff line number Diff line change 1+ # Switch AWS Fusion profile
2+ aws- fusion config- switch profile
3+ if ($LASTEXITCODE -ne 0 ) {
4+ return
5+ }
6+
7+ # Read the selected profile
8+ $selectedProfile = Get-Content " $HOME \.aws\fusion\profile"
9+
10+ # Unset AWS_REGION
11+ Remove-Item Env:AWS_REGION - ErrorAction SilentlyContinue
12+
13+ if ([string ]::IsNullOrWhiteSpace($selectedProfile )) {
14+ # Unset AWS_PROFILE for default profile
15+ Remove-Item Env:AWS_PROFILE - ErrorAction SilentlyContinue
16+ } else {
17+ # Set AWS_PROFILE
18+ $Env: AWS_PROFILE = $selectedProfile
19+ }
Original file line number Diff line number Diff line change 1+ # Switch AWS Fusion region
2+ aws- fusion config- switch region
3+ if ($LASTEXITCODE -ne 0 ) {
4+ return
5+ }
6+
7+ # Read the selected region
8+ $selectedRegion = Get-Content " $HOME \.aws\fusion\region"
9+
10+ # Check if the selected region is empty
11+ if ([string ]::IsNullOrWhiteSpace($selectedRegion )) {
12+ # Unset AWS_REGION as it matches the one in the current profile
13+ Remove-Item Env:AWS_REGION - ErrorAction SilentlyContinue
14+ } else {
15+ # Set AWS_REGION
16+ $Env: AWS_REGION = $selectedRegion
17+ }
Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22import os
33import re
4+ import platform
45
56from setuptools import find_packages
67from setuptools import setup
@@ -21,6 +22,19 @@ def find_version(*file_paths):
2122 return version_match .group (1 )
2223 raise RuntimeError ("Unable to find version string." )
2324
25+ # Determine the scripts based on the operating system
26+ if platform .system () in ["Linux" , "Darwin" ]:
27+ scripts = [
28+ 'bin/_awsp' ,
29+ 'bin/_awsr'
30+ ]
31+ if platform .system () == "Windows" :
32+ scripts = [
33+ 'bin/_awsp.ps1' ,
34+ 'bin/_awsr.ps1'
35+ ]
36+ else :
37+ scripts = []
2438
2539setup (
2640 name = 'aws-fusion' ,
@@ -42,10 +56,7 @@ def find_version(*file_paths):
4256 'aws-fusion = aws_fusion.app:main' ,
4357 ]
4458 },
45- scripts = [
46- 'bin/_awsp' ,
47- 'bin/_awsr'
48- ],
59+ scripts = scripts ,
4960 install_requires = [
5061 'boto3>=1.29' ,
5162 'pyperclip>=1.8' ,
You can’t perform that action at this time.
0 commit comments