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

doc(README): Make shell snippet copy&paste safe #336

Merged
merged 1 commit into from
Jun 26, 2024

Commits on Jun 26, 2024

  1. doc(README): Make shell snippet copy&paste safe

    Many bash/shell snippets in the README use an environment variable
    `YOUR_CONTAINER_REGISTRY`, which is used as `$YOUR_CONTAINER_REGISTRY`.
    
    However, that has the downside that if users copy & paste the snippet
    and accidentally press enter or use a shell that doesn't allow multi-
    line pasting (and executes it immediately), then the variable will be
    replaced by an empty string, because it wasn't set before.
    
    It's good practice to make those snippets copy&paste-safe.
    We can achieve that by adding `:?` to the variable, which emits an
    error if the variable is unset or null.
    
    See https://devhints.io/bash for a bash cheat sheet.
    
    Example:
    
    ```sh
    docker push ${YOUR_CONTAINER_REGISTRY:?}/bookshop-srv
    ```
    
    On ZSH:
    
    ```
    zsh: YOUR_CONTAINER_REGISTRY: parameter not set
    ```
    
    On Bash:
    
    ```
    bash: YOUR_CONTAINER_REGISTRY: parameter null or not set
    ```
    bugwelle committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    12923bd View commit details
    Browse the repository at this point in the history