Skip to content

--profile missing from quarto call engine, call build-ts-extension, and call typst-gather --help #14915

Description

@cderv

quarto call engine, quarto call build-ts-extension, and quarto call typst-gather --help are all missing --profile, while quarto call axe --help has it:

$ quarto call typst-gather --help
...
Options:

  -h, --help               - Show this help.
  --init-config            - Generate a starter typst-gather.toml in current directory
  --log          <file>    - Path to log file
  --log-level    <level>   - Log level (debug, info, warning, error, critical)
  --log-format   <format>  - Log format (plain, json-stream)
  --quiet                  - Suppress console output.

$ quarto call axe --help
...
  --log         <file>       - Path to log file
  --log-level   <level>      - Log level (debug, info, warning, error, critical)
  --log-format  <format>     - Log format (plain, json-stream)
  --quiet                    - Suppress console output.
  --profile                  - Active project profile(s)

--profile is registered as a global option in appendProfileArg:

export function appendProfileArg(cmd: Command<any>): Command<any> {
return cmd.option(
"--profile",
"Active project profile(s)",
{
global: true,
},
);

This relies on cliffy's native global: true option inheritance, which per #8438 does not reliably reach every subcommand. appendLogOptions hit the same bug and works around it by manually forwarding the log/quiet options to every subcommand instead of trusting cliffy's inheritance:

// If there are subcommands, forward the log options
// directly to the subcommands. Otherwise, just attach
// to the outer command
//
// Fixes https://github.com/quarto-dev/quarto-cli/issues/8438
//
// Include hidden subcommands (e.g. `quarto call axe`, which is `.hidden()`
// while experimental): `.hidden()` only affects `--help` visibility, not
// whether the subcommand should accept forwarded log options.
const subCommands = cmd.getCommands(true);
if (subCommands.length > 0) {
subCommands.forEach((command) => {
addLogOptions(command);
});
return cmd;
} else {
return addLogOptions(cmd);
}
}

appendProfileArg never got the same treatment, so it still depends on cliffy's inheritance and only reaches the last subcommand registered under call:

export const callCommand = new Command()
.name("call")
.description(
"Access functions of Quarto subsystems such as its rendering engines.",
)
.action(() => {
callCommand.showHelp();
Deno.exit(1);
})
.command("engine", engineCommand)
.command("build-ts-extension", buildTsExtensionCommand)
.command("typst-gather", typstGatherCommand)
// hidden while experimental: invocable, not advertised in `quarto call` help
.command("axe", axeCommand);

axe was added last (#14815) and is the only one that got --profile by coincidence. This also explains why quarto-web's automated reference docs lost --profile from quarto call typst-gather between v1.11.3 and v1.11.5, even though nothing in typst-gather's own command changed.

We could apply the same subcommand-forwarding pattern from appendLogOptions to appendProfileArg.

Related: #8438

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationDoc improvements & quarto-web

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions