quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.81k stars 309 forks source link

Hard to figure out how to call `quarto create project` #10578

Open jennybc opened 1 month ago

jennybc commented 1 month ago

What would you like to do?

Give feedback or suggest an improvement

Description

I had some trouble figuring out how to call quarto create project -- especially non-interactively or with --no-prompt. I give some details below these are the main points:

Here's what I currently see for how to use quarto create project:

~/rrr/usethis % quarto create project --help

Usage:   quarto create [type] [commands...]
Version: 1.5.47                            

Description:

  Create a Quarto project or extension

Options:

  -h, --help              - Show this help.                                    
  --open        [editor]  - Open new artifact in this editor (vscode,rstudio)  
  --no-open               - Do not open in an editor                           
  --no-prompt             - Do not prompt to confirm actions                   
  --log         <file>    - Path to log file                                   
  --log-level   <level>   - Log level (info, warning, error, critical)         
  --log-format  <format>  - Log format (plain, json-stream)                    
  --quiet                 - Suppress console output.                           
  --profile               - Active project profile(s)                          

Commands:

  help  [command]  - Show this help or the help of a sub-command.

I'm not sure what the [commands...] bit should be. I figured it out by successively adding inputs and noticing what I was being prompted for.

~/tmp % quarto create blah
Unknown type blah - please select from the following:
? Create
❯ project
  extension
# (ok `type` should be `project`)

~/tmp % quarto create project blah  
? Type
❯ default
  website
  blog
  manuscript
  book
  confluence
# (a new type appears! morally `--project-type=default`)

~/tmp % quarto create project default blah
# (now I get a prompt to specify a project title)

Culminating in this successful call:

~/tmp % quarto create project default blah1 blah2
Creating project at /Users/jenny/tmp/blah1:
  - Created _quarto.yml
  - Created blah2.qmd

So I think it's:

quarto create project [project-type] [project-folder-name] [?project-title?]
cscheid commented 1 month ago

I agree that we need to improve the situation, possibly not only with documentation.

I don't know why we decided to keep the following option quiet, but we have quarto create --json. You give it a JSON object on stdin, and it writes back on stdout a JSON object describing what happened:

https://github.com/quarto-dev/quarto-cli/blob/92cad4456c4e8b635979d6b39f45b507aba70edb/src/command/create/cmd.ts#L38-L54

https://github.com/quarto-dev/quarto-cli/blob/92cad4456c4e8b635979d6b39f45b507aba70edb/src/command/create/cmd.ts#L274-L279