Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,12 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::cli_localization::build_localizer;
use crate::snapshot_test_support::snapshot_settings;
use crate::theme::ThemePreference;
use insta::assert_snapshot;
use rstest::rstest;
use test_support::fluent::normalize_fluent_isolates;

#[test]
fn config_projection_preserves_shared_preferences() {
Expand Down Expand Up @@ -348,4 +353,38 @@ mod tests {

assert_eq!(cli.config(), expected);
}

#[rstest]
#[case::en_us(
"en-US",
"help_en_us",
"Path to a configuration file, bypassing automatic discovery."
)]
#[case::es_es(
"es-ES",
"help_es_es",
"Ruta a un archivo de configuración, omitiendo la detección automática."
)]
fn localized_help_snapshots_include_config_flag(
#[case] locale: &str,
#[case] snapshot_name: &str,
#[case] config_help: &str,
) {
let localizer = build_localizer(Some(locale));
let mut command = localize_command(Cli::command(), localizer.as_ref());
let rendered_help = command.render_long_help().to_string();
let normalized_help = normalize_fluent_isolates(&rendered_help);

assert!(
normalized_help.contains("--config <FILE>"),
"localized help for {locale} should include the config flag"
);
assert!(
normalized_help.contains(config_help),
"localized help for {locale} should include the config flag description"
);
snapshot_settings("cli").bind(|| {
assert_snapshot!(snapshot_name, normalized_help);
});
}
}
96 changes: 96 additions & 0 deletions src/snapshots/cli/netsuke__cli__tests__help_en_us.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
source: src/cli/mod.rs
expression: normalized_help
---
Netsuke transforms YAML + Jinja manifests into reproducible Ninja graphs and runs Ninja with safe defaults.

Usage: netsuke [OPTIONS] [COMMAND]

Commands:
build Build targets defined in the manifest (default).
clean Remove build artefacts via Ninja.
graph Emit the dependency graph in DOT format.
manifest Write the generated Ninja manifest without running Ninja.
help Print this message or the help of the given subcommand(s)

Options:
-f, --file <FILE>
Path to the Netsuke manifest file to use.

[default: Netsukefile]

-C, --directory <DIR>
Run as if started in this directory.

This affects manifest lookup, output paths, and config discovery.

--config <FILE>
Path to a configuration file, bypassing automatic discovery.

-j, --jobs <N>
Set the number of parallel build jobs.

Values must be between 1 and 64.

--fetch-allow-scheme <SCHEME>
Additional URL schemes allowed for the fetch helper.

--fetch-allow-host <HOST>
Hostnames that are permitted when default deny is enabled.

Supports wildcards such as `*.example.com`.

--fetch-block-host <HOST>
Hostnames that are always blocked, even when allowed elsewhere.

Supports wildcards such as `*.example.com`.

--fetch-default-deny
Deny all hosts by default; only allow the declared allowlist.

-v, --verbose
Enable verbose diagnostic logging and completion timing summaries.

--locale <LOCALE>
Locale tag for CLI copy (for example: en-US, es-ES).

--accessible <ACCESSIBLE>
Force accessible output mode on or off.

[possible values: true, false]

--no-emoji <NO_EMOJI>
Suppress emoji glyphs in output.

[possible values: true, false]

--theme <THEME>
CLI theme preset (auto, unicode, ascii).

--colour-policy <POLICY>
Colour output policy (auto, always, never).

--progress <PROGRESS>
Force standard progress summaries on or off.

When omitted, Netsuke enables progress summaries in standard mode.

[possible values: true, false]

--spinner-mode <MODE>
Progress spinner display mode (enabled, disabled).

--diag-json
Emit machine-readable diagnostics as JSON on stderr.

--output-format <FORMAT>
Diagnostic output format (human, json).

--default-target <TARGET>
Default build targets when none are specified.

-h, --help
Print help (see a summary with '-h')

-V, --version
Print version
96 changes: 96 additions & 0 deletions src/snapshots/cli/netsuke__cli__tests__help_es_es.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
source: src/cli/mod.rs
expression: normalized_help
---
Netsuke transforma manifiestos YAML + Jinja en grafos Ninja reproducibles y ejecuta Ninja con valores seguros.

Usage: netsuke [OPTIONS] [COMMAND]

Commands:
build Compila objetivos definidos en el manifiesto (predeterminado).
clean Elimina artefactos de compilación mediante Ninja.
graph Emite el grafo de dependencias en formato DOT.
manifest Escribe el manifiesto Ninja sin ejecutar Ninja.
help Print this message or the help of the given subcommand(s)

Options:
-f, --file <FILE>
Ruta al archivo de manifiesto Netsuke.

[default: Netsukefile]

-C, --directory <DIR>
Run as if started in this directory.

This affects manifest lookup, output paths, and config discovery.

--config <FILE>
Ruta a un archivo de configuración, omitiendo la detección automática.

-j, --jobs <N>
Set the number of parallel build jobs.

Values must be between 1 and 64.

--fetch-allow-scheme <SCHEME>
Esquemas de URL adicionales permitidos para el ayudante fetch.

--fetch-allow-host <HOST>
Hostnames that are permitted when default deny is enabled.

Supports wildcards such as `*.example.com`.

--fetch-block-host <HOST>
Hostnames that are always blocked, even when allowed elsewhere.

Supports wildcards such as `*.example.com`.

--fetch-default-deny
Denegar todos los hosts por defecto; solo permitir la lista de permitidos.

-v, --verbose
Habilitar registro de diagnóstico detallado y resúmenes de tiempo al completar.

--locale <LOCALE>
Etiqueta de idioma para la CLI (por ejemplo: en-US, es-ES).

--accessible <ACCESSIBLE>
Forzar el modo de salida accesible (activado o desactivado).

[possible values: true, false]

--no-emoji <NO_EMOJI>
Suprimir glifos emoji en la salida.

[possible values: true, false]

--theme <THEME>
Tema predefinido de CLI (auto, unicode, ascii).

--colour-policy <POLICY>
Política de color de salida (auto, always, never).

--progress <PROGRESS>
Force standard progress summaries on or off.

When omitted, Netsuke enables progress summaries in standard mode.

[possible values: true, false]

--spinner-mode <MODE>
Modo de visualización del spinner de progreso (enabled, disabled).

--diag-json
Emitir diagnósticos legibles por máquinas como JSON en stderr.

--output-format <FORMAT>
Formato de salida de diagnósticos (human, json).

--default-target <TARGET>
Objetivos de compilación predeterminados cuando no se especifica ninguno.

-h, --help
Print help (see a summary with '-h')

-V, --version
Print version
Loading