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: Update 'use_git' example #1191

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

tommygarvin
Copy link

@tommygarvin tommygarvin commented May 20, 2024

Changes

  • Fix: Update use_git example where boolean should be bool
  • Fix: Update use_git example to remove choices field
  • Fix: Update Supported Types "text" section so CTRL-D is rendered
  • Style: Replace static text with a reference to 'supported types' section
  • Style: Adjust whitespace

Context

use_git example

If you attempt to run the use_git example as it is currently you'll receive

Error: invalid type for variable use_git: boolean possible values are bool and string

And, after you change it from boolean to bool you'll receive

Error: bool type does not support choices field

CTRL-D

The rendered page does not show CTRL-D

"text": Represents a multiline string value. (terminated by hitting )

@tommygarvin
Copy link
Author

Any feedback @sassman & @joshrotenberg ?

@@ -40,19 +40,18 @@ Consider the following `cargo-generate.toml` file:
```toml
[placeholders]
project_name = { prompt = "Enter project name", default = "my_project", type = "string" }
use_git = { prompt = "Initialize Git repository?", choices = ["Yes", "No"], default = "Yes", type = "boolean" }
use_git = { prompt = "Initialize Git repository?", default = true, type = "bool" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logically you're making sense here. However, the intent was to showcase the choices.
So the better fix would be type = "string"

But maybe we keep this, and add a different example for choices.

- `"editor"`: Represents a multiline string value, collected from the user by a real terminal editor.
- `"boolean"`: Represents a boolean value (`true` or `false`).
- `"bool"`: Represents a boolean value (`true` or `false`).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

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

Successfully merging this pull request may close these issues.

None yet

2 participants