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

"proposals" aren't allowing free-form input? #310

Open
j2udev opened this issue Dec 28, 2024 · 0 comments
Open

"proposals" aren't allowing free-form input? #310

j2udev opened this issue Dec 28, 2024 · 0 comments

Comments

@j2udev
Copy link

j2udev commented Dec 28, 2024

I'm working on creating a few of my own templates, but noticed that options that are using "proposals" aren't allowing free form input? It either just auto selects the default or inputs an empty string. This contradicts what the docs say here:
https://containers.dev/implementors/templates/

A list of suggested string values. Free-form values are allowed. Omit when using optionId.enum.

Here is my devcontainer.json template:

{
    "name": "${templateOption:devcontainer_name}",
    "build": {
        "dockerfile": "Dockerfile"
    },
    "customizations": {
        "vscode": {
            "extensions": ["esbenp.prettier-vscode"]
        }
    },
    "features": {
        "ghcr.io/devcontainers/features/docker-in-docker:2": {},
        "ghcr.io/j2udev/devcontainer-features/oh-my-posh:0": {
            "theme": "${templateOption:oh_my_posh_theme}"
        },
        "ghcr.io/j2udev/devcontainer-features/eza:0": {
            "theme": "${templateOption:eza_theme}"
        },
        "ghcr.io/j2udev/devcontainer-features/bat:0": {
            "theme": "${templateOption:bat_theme}"
        },
        "ghcr.io/j2udev/devcontainer-features/fzf:0": {},
        "ghcr.io/j2udev/devcontainer-features/lazygit:0": {}
    }
}

and here is my devcontainer-template.json

{
    "id": "base-dockerfile-features",
    "version": "0.1.2",
    "name": "Base/Dockerfile/Features",
    "description": "A base template that creates a Dockerfile and uses features",
    "documentationURL": "https://github.com/j2udev/devcontainer-templates/tree/main/src/base-dockerfile-features",
    "licenseURL": "https://github.com/j2udev/devcontainer-templates/blob/main/LICENSE",
    "options": {
        "devcontainer_name": {
            "type": "string",
            "description": "The name of your Dev Container"
        },
        "ubuntu_version": {
            "type": "string",
            "description": "Ubuntu version",
            "proposals": ["noble", "jammy", "focal", "bionic"],
            "default": "noble"
        },
        "oh_my_posh_theme": {
            "type": "string",
            "description": "oh-my-posh theme",
            "proposals": [
                "bubbles",
                "catppuccin",
                "craver",
                "gruvbox",
                "j2udev",
                "robbyrussell",
                "sonicboom_light",
                "sonicboom_dark",
                "tonybaloney"
            ],
            "default": "j2udev"
        },
        "eza_theme": {
            "type": "string",
            "description": "eza theme",
            "proposals": [
                "catppuccin",
                "dracula",
                "frosty",
                "gruvbox-dark",
                "one_dark",
                "tokyonight"
            ],
            "default": "tokyonight"
        },
        "bat_theme": {
            "type": "string",
            "description": "bat theme",
            "proposals": [
                "default",
                "Dracula",
                "GitHub",
                "gruvbox-dark",
                "gruvbox-light",
                "Monokai Extended",
                "Nord",
                "OneHalfDark",
                "OneHalfLight",
                "Solarized (dark)",
                "Solarized (light)",
                "TwoDark"
            ],
            "default": "default"
        }
    },
    "platforms": ["Any"]
}

Feel free to see for yourself by trying the template:

ghcr.io/j2udev/devcontainer-templates/base-dockerfile-features
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant