### Install Whoiam with Homebrew Source: https://github.com/cliwright/whoiam/blob/main/README.md Install the whoiam CLI using the Homebrew package manager. Ensure you have tapped the correct repository first. ```bash brew tap cliwright/cliwright brew install whoiam ``` -------------------------------- ### Install Whoiam with Homebrew Source: https://github.com/cliwright/whoiam/blob/main/docs/installation.md Use this command to install the Whoiam CLI via Homebrew. Ensure you have Homebrew installed and configured. ```sh brew tap cliwright/cliwright && \ brew install whoiam ``` -------------------------------- ### Download and Install Linux Binary Source: https://github.com/cliwright/whoiam/blob/main/docs/installation.md Download the pre-compiled Linux binary, extract it, make it executable, and move it to your system's PATH. Replace VERSION with the desired release tag. ```sh curl -L -o whoiam_linux_x86_64.tar.gz https://github.com/cliwright/whoiam/releases/download/VERSION/whoiam_Linux_x86_64.tar.gz && \ tar -xzf whoiam_linux_x86_64.tar.gz && \ chmod +x whoiam && \ sudo mv whoiam /usr/local/bin/ ``` -------------------------------- ### Build Whoiam from Source Source: https://github.com/cliwright/whoiam/blob/main/docs/installation.md Clone the repository and build the Whoiam executable from source using Go. Ensure you have Go installed. ```sh git clone https://github.com/cliwright/whoiam.git && \ cd whoiam && \ go build -o whoiam ``` -------------------------------- ### Install Whoiam with Aqua Source: https://github.com/cliwright/whoiam/blob/main/docs/installation.md Install Whoiam using Aqua, a CLI version manager. This command registers Whoiam with your Aqua environment. ```sh aqua g -i cliwright/whoiam ``` -------------------------------- ### Download and Install macOS Binary Source: https://github.com/cliwright/whoiam/blob/main/docs/installation.md Download the pre-compiled macOS binary, extract it, make it executable, and move it to your system's PATH. Replace VERSION with the desired release tag. ```sh curl -L -o whoiam_darwin_x86_64.tar.gz https://github.com/cliwright/whoiam/releases/download/VERSION/whoiam_Darwin_x86_64.tar.gz && \ tar -xzf whoiam_darwin_x86_64.tar.gz && \ chmod +x whoiam && \ sudo mv whoiam /usr/local/bin/ ``` -------------------------------- ### Configure Whoiam Account Mappings Source: https://github.com/cliwright/whoiam/blob/main/README.md Edit the .whoiam/whoiam.yaml file to define your AWS account mappings. This example shows production, staging, and development accounts. ```yaml accounts: production: "123456789012" staging: "210987654321" development: "345678901234" ``` -------------------------------- ### Validate in Taskfile Source: https://github.com/cliwright/whoiam/blob/main/docs/usage.md Example of using `whoiam validate` as a pre-command check within a Taskfile before executing a deployment. ```yaml tasks: deploy: cmds: - whoiam validate --env production - terraform apply ``` -------------------------------- ### Initialize Whoiam Project Configuration Source: https://github.com/cliwright/whoiam/blob/main/README.md Initialize a project-local configuration file for whoiam. This creates the .whoiam/whoiam.yaml file. ```bash whoiam init ``` -------------------------------- ### Set Expected Environment and Execute Command Source: https://github.com/cliwright/whoiam/blob/main/docs/index.md Pin the expected environment for the current session and then execute a command, with Whoiam verifying the account context before running. ```shell whoiam set development whoiam exec -- terraform apply ``` -------------------------------- ### Initialize Global Config Source: https://github.com/cliwright/whoiam/blob/main/docs/usage.md Creates a global configuration file (`~/.whoiam/whoiam.yaml`) for settings that apply across all projects. ```sh whoiam init --global ``` -------------------------------- ### Download Windows Binary Source: https://github.com/cliwright/whoiam/blob/main/docs/installation.md Download the pre-compiled Windows binary. Replace VERSION with the desired release tag. ```sh curl -L -o whoiam_windows_x86_64.zip https://github.com/cliwright/whoiam/releases/download/VERSION/whoiam_Windows_x86_64.zip ``` -------------------------------- ### Mise Hooks and Tasks Source: https://github.com/cliwright/whoiam/blob/main/docs/usage.md Demonstrates setting an environment hook and executing a command with `whoiam exec` within a `mise.toml` configuration. ```toml [hooks.enter] run = "whoiam set development" [tasks.deploy] run = "whoiam exec --env production -- terraform apply" ``` -------------------------------- ### Run Tests Source: https://github.com/cliwright/whoiam/blob/main/docs/contributing.md Run the tests to ensure your changes do not break existing functionality. Add new tests if necessary. ```sh go test ./... ``` -------------------------------- ### View Merged Configuration Source: https://github.com/cliwright/whoiam/blob/main/docs/usage.md Prints the effective merged configuration, showing both global and project-local settings and their sources. This helps in understanding how configurations are applied. ```sh whoiam config ``` -------------------------------- ### Clone Repository Source: https://github.com/cliwright/whoiam/blob/main/docs/contributing.md Clone your forked repository to your local machine. ```sh git clone https://github.com//whoiam.git ``` -------------------------------- ### Push Changes Source: https://github.com/cliwright/whoiam/blob/main/docs/contributing.md Push your changes to your forked repository. ```sh git push origin my-feature-branch ``` -------------------------------- ### Merged Configuration Display Source: https://github.com/cliwright/whoiam/blob/main/docs/configuration.md Shows the merged configuration from global and project-local files, indicating the source of each account definition. Project-local definitions take precedence. ```text +---------------+----------------+--------+ | ACCOUNT NAME | ACCOUNT NUMBER | SOURCE | +---------------+----------------+--------+ | production | 123456789012 | local | | staging | 210987654321 | global | +---------------+----------------+--------+ ``` -------------------------------- ### Create New Branch Source: https://github.com/cliwright/whoiam/blob/main/docs/contributing.md Create a new branch for your changes to keep your work organized. ```sh git checkout -b my-feature-branch ``` -------------------------------- ### Execute Command Using Set Expected Environment Source: https://github.com/cliwright/whoiam/blob/main/docs/usage.md Executes a command after verifying against the expected environment that was previously set using `whoiam set`. The `--env` flag can be omitted if the environment is already configured. ```sh whoiam set production whoiam exec -- terraform apply ``` -------------------------------- ### Set Expected Environment for Session Source: https://github.com/cliwright/whoiam/blob/main/README.md Pin the expected AWS environment for the current session using the 'whoiam set' command. This tells whoiam which account to expect. ```bash whoiam set production ``` -------------------------------- ### Execute Command with Explicit Environment Verification Source: https://github.com/cliwright/whoiam/blob/main/docs/usage.md Verifies the AWS account against the specified environment before executing the provided command. If verification fails, the command is not run. ```sh whoiam exec --env production -- terraform apply ``` -------------------------------- ### Execute Command with Inline Expected Account Source: https://github.com/cliwright/whoiam/blob/main/docs/index.md Execute a command, specifying the expected AWS account context directly via an environment variable. ```shell AWS_PROFILE=production whoiam exec -- terraform apply ``` -------------------------------- ### Execute Commands Safely with Whoiam Source: https://github.com/cliwright/whoiam/blob/main/README.md Run commands safely through whoiam. It will verify the current AWS account against the pinned environment before executing the command. ```bash whoiam exec -- terraform apply ``` -------------------------------- ### Open Interactive Subshell with Verified Account Source: https://github.com/cliwright/whoiam/blob/main/docs/usage.md Opens an interactive subshell after verifying that the current AWS credentials match the specified environment. Useful for performing actions within a verified context. ```sh whoiam exec --env production ``` -------------------------------- ### Commit Changes Source: https://github.com/cliwright/whoiam/blob/main/docs/contributing.md Commit your changes with a descriptive commit message. ```sh git add . git commit -m "Add feature X" ``` -------------------------------- ### Validate Against Set Expected Environment Source: https://github.com/cliwright/whoiam/blob/main/docs/usage.md Asserts that the current AWS credentials match the environment previously set using `whoiam set`. Exits with a non-zero status code on mismatch. ```sh whoiam validate ``` -------------------------------- ### YAML Configuration Format Source: https://github.com/cliwright/whoiam/blob/main/docs/configuration.md Defines account names and their corresponding AWS account IDs in a YAML file. Each key is a user-defined name, and the value is the 12-digit AWS account ID. ```yaml accounts: production: "123456789012" staging: "210987654321" development: "345678901234" ``` -------------------------------- ### Check Current Status Source: https://github.com/cliwright/whoiam/blob/main/docs/usage.md Displays the currently expected environment (local or global) and whether the user is authenticated with the expected AWS account. ```sh whoiam status ``` -------------------------------- ### Set Global Expected Environment Source: https://github.com/cliwright/whoiam/blob/main/docs/usage.md Sets the expected AWS environment globally, applying to all projects unless overridden by a project-local setting. ```sh whoiam set --global staging ``` -------------------------------- ### Validate Current Account Context with Inline Expected Account Source: https://github.com/cliwright/whoiam/blob/main/docs/index.md Validate the current AWS account context against an expected environment specified via an environment variable. ```shell WHOIAM_EXPECTED_ENV=staging whoiam validate ``` -------------------------------- ### Clear Project-Local Expected Environment Source: https://github.com/cliwright/whoiam/blob/main/docs/usage.md Removes the locally configured expected AWS environment. ```sh whoiam clear ``` -------------------------------- ### Validate Against Explicit Environment Source: https://github.com/cliwright/whoiam/blob/main/docs/usage.md Asserts that the current AWS credentials match the specified environment. Useful for CI/CD pipelines or pre-flight checks. ```sh whoiam validate --env production ``` -------------------------------- ### Environment Variable Override for Execution Source: https://github.com/cliwright/whoiam/blob/main/docs/configuration.md Sets the WHOIAM_EXPECTED_ENV environment variable to 'staging' to specify the expected AWS environment for executing a command like 'terraform plan'. Useful for CI pipelines. ```sh WHOIAM_EXPECTED_ENV=staging whoiam exec -- terraform plan ``` -------------------------------- ### Clear Global Expected Environment Source: https://github.com/cliwright/whoiam/blob/main/docs/usage.md Removes the globally configured expected AWS environment. ```sh whoiam clear --global ``` -------------------------------- ### Environment Variable Override for Validation Source: https://github.com/cliwright/whoiam/blob/main/docs/configuration.md Sets the WHOIAM_EXPECTED_ENV environment variable to 'production' to validate the expected AWS environment before executing a command. Useful for CI pipelines. ```sh WHOIAM_EXPECTED_ENV=production whoiam validate ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.