diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 633b74626ab..9287f202526 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,15 +1,7 @@ name: CI on: - pull_request: - branches: - - main - - 'release/**' - - push: - branches: - - main - - 'release/**' + workflow_dispatch: {} permissions: contents: read diff --git a/.github/workflows/reproduce-flaky-tests.yml b/.github/workflows/reproduce-flaky-tests.yml index 2f244a22fa1..55d856f43c5 100644 --- a/.github/workflows/reproduce-flaky-tests.yml +++ b/.github/workflows/reproduce-flaky-tests.yml @@ -20,7 +20,7 @@ on: env: # Test project shortname (maps to tests/Aspire.{name}.Tests/ or tests/{name}.Tests/) # Examples: Hosting, Core, Dashboard, Components.Common, Cli.EndToEnd - TEST_PROJECT: "Hosting" + TEST_PROJECT: "Cli" # Test filter arguments passed to dotnet test (after the -- separator). # Use quotes around wildcard patterns to prevent shell glob expansion. @@ -28,11 +28,11 @@ env: # --filter-method "*.TestMethodName" # --filter-class "*.TestClassName" # --filter-method "*.Test1" --filter-method "*.Test2" - TEST_FILTER: '--filter-method "*.YourTestMethodName"' + TEST_FILTER: '--filter-class "*.GitCommandRunnerTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"' # Target operating systems (comma-separated) # Options: ubuntu-latest, windows-latest, macos-latest - TARGET_OSES: "ubuntu-latest,windows-latest" + TARGET_OSES: "ubuntu-latest,windows-latest,macos-latest" # Number of parallel runners per OS # Total jobs = RUNNERS_PER_OS × number of OSes (must be ≤ 256) diff --git a/docs/specs/cli-config-sources.md b/docs/specs/cli-config-sources.md index 6fe78f6d11e..9fc0d05c584 100644 --- a/docs/specs/cli-config-sources.md +++ b/docs/specs/cli-config-sources.md @@ -145,7 +145,7 @@ When the CLI host supports interactive input, fetch with inherited terminal inpu Unattended configuration-source Git operations (including opted-in JSON listing, non-interactive `new`/`init`, and advisory checks) override `core.askPass` only for the child process and disable `GIT_ASKPASS`, `SSH_ASKPASS`, terminal prompts and Git Credential Manager interaction. Standard input receives EOF. This also applies when `--non-interactive`, `ASPIRE_NON_INTERACTIVE`, or CI disables host input. Credential helpers remain enabled for cached credentials; custom credential helpers must themselves run without prompting. Interactive Git acquisition and captured template-repository acquisition retain their existing authentication behavior. -Unattended SSH resolves the selected executable through Git's effective child `PATH`, including Git for Windows' bundled executable directories, rather than substituting an OpenSSH client found on the CLI's own `PATH`. It verifies that executable and supplies `BatchMode=yes`, preserving configured identity files, known hosts and agent authentication. Unknown host keys and unavailable credentials fail rather than prompt. Bare OpenSSH executable selections through `GIT_SSH`, `GIT_SSH_COMMAND` or `core.sshCommand` are supported, but custom command strings with arguments, shell expansions or wrappers fail with an actionable diagnostic instead of being silently overwritten or receiving potentially incompatible OpenSSH options. Move identity/host options into OpenSSH configuration or use interactive acquisition for those commands. Custom credential helpers, SSH agents and proxy commands are not sandboxed and must already be unattended. Git URL rewrites are resolved before selecting this SSH policy, so HTTPS selectors rewritten to SSH receive the same protection. No user Git configuration is modified. +Unattended SSH resolves the selected executable through Git's effective child `PATH`, including Git for Windows' bundled executable directories, rather than substituting an OpenSSH client found on the CLI's own `PATH`. It verifies that executable and supplies `BatchMode=yes`, preserving configured identity files, known hosts and agent authentication. The version probe allows slow process startup within a 30-second limit and honors the enclosing operation's cancellation budget. Unknown host keys and unavailable credentials fail rather than prompt. Bare OpenSSH executable selections through `GIT_SSH`, `GIT_SSH_COMMAND` or `core.sshCommand` are supported, but custom command strings with arguments, shell expansions or wrappers fail with an actionable diagnostic instead of being silently overwritten or receiving potentially incompatible OpenSSH options. Move identity/host options into OpenSSH configuration or use interactive acquisition for those commands. Custom credential helpers, SSH agents and proxy commands are not sandboxed and must already be unattended. Git URL rewrites are resolved before selecting this SSH policy, so HTTPS selectors rewritten to SSH receive the same protection. No user Git configuration is modified. If a non-interactive fetch blocks waiting for a custom authentication helper, the 30-second timeout terminates its process tree and reports the timeout. Capture output without truncation, including prompts without a terminating newline, and display the last 64 Ki characters of the combined fetch output on stderr so the user can diagnose and correct authentication. Local query results remain complete. Do not display captured configuration-file contents or copy these diagnostics into exception messages, logs, or telemetry. User cancellation and shutdown cancellation do not display captured output. Advisory timeout output is deferred with the warning until command exit and does not change the foreground command's exit code. @@ -232,6 +232,24 @@ A tracking copy is shared by source identity, not a record of what every applica Missing `configSource.repository` or `configSource.path` must not prevent general configuration loading or discard the app's saved settings. Validate these fields when the binding is used: an advisory check reports the invalid binding without failing the project operation, while an explicit configuration-source refresh fails before Git acquisition or application-file changes. +### Edit array-valued settings + +Configuration keys use dots (or colons) for object properties and bracketed indices for arrays: + +```shell +aspire config set "skillSources.team.plugins[0]" deployment +aspire config get "skillSources.team.plugins[0]" +aspire config delete "skillSources.team.plugins[0]" +``` + +Quote bracketed keys to prevent shell glob expansion. Brackets are reserved for non-negative integer indices, including nested arrays such as `matrix[0][1]`. + +Setting an existing index replaces only that element. An index equal to the array length appends an element; larger indices and negative indices are rejected without changing the file. If the array property is missing or null, `[0]` creates it. Explicit bracket syntax never replaces an existing object or scalar with an array. + +Numeric dot or colon segments can also address an existing array, so `skillSources.team.plugins.0` edits element zero when `plugins` is already an array. Otherwise numeric segments remain object property names: creating `custom.0` creates an object with a `"0"` property. Use brackets when creating an array rather than relying on numeric property names. + +Deleting an array element shifts subsequent elements down by one index. Deleting the final element leaves an empty array, and deleting a property within an array element preserves the element even if it becomes an empty object. `aspire config list` displays individual array entries using bracketed indices, including `null` for null array elements, while empty arrays and objects remain visible. + ### Check for updates without applying them Operations that resolve an Aspire project or select a running AppHost check the saved source in the nearest local settings file for newer versions. Global bindings are not read, validated, checked, or acquired. Initialization of an already-bound project uses the same discovery from the resolved project directory. Commands that do not resolve a project, such as agent setup, configuration inspection, and documentation lookup, do not perform an ambient source check. Agent setup targets an agent workspace, which is not necessarily the AppHost directory. The check is advisory: the requested operation uses saved configuration whether a source is newer, unavailable, or has never been fetched on this machine. diff --git a/src/Aspire.Cli/Configuration/ConfigurationService.cs b/src/Aspire.Cli/Configuration/ConfigurationService.cs index afe381f1a9d..ba7a8f5ce10 100644 --- a/src/Aspire.Cli/Configuration/ConfigurationService.cs +++ b/src/Aspire.Cli/Configuration/ConfigurationService.cs @@ -52,18 +52,21 @@ internal static async Task SetConfigurationInFileAsync(string settingsFilePath, } ConfigurationHelper.NormalizeSettings(settings); - key = TemplateSourceConfiguration.ValidateEditKey(settings, key); + var keyParts = ParseKey(key); + var resolvedKey = TemplateSourceConfiguration.ValidateEditKey(settings, string.Join('.', keyParts.Select(part => part.Name))); + ResolveKeyParts(keyParts, resolvedKey); // Validate the candidate under the config lock, before writing. A rejected edit must // preserve the original file, including comments and unrelated settings. - SetNestedValue(settings, key, value); - TemplateSourceConfiguration.ValidateEditedSource(settings, key); + SetNestedValue(settings, keyParts, key, value); + TemplateSourceConfiguration.ValidateEditedSource(settings, resolvedKey); await ConfigurationHelper.WriteSettingsFileAtomicallyAsync(settingsFilePath, settings, cancellationToken, preserveOwnershipAndAcl: true); } public async Task DeleteConfigurationAsync(string key, bool isGlobal = false, CancellationToken cancellationToken = default) { + var keyParts = ParseKey(key); var settingsFilePath = GetSettingsFilePath(isGlobal); using var configLock = await ConfigurationHelper.TryAcquireWorkspaceConfigLockAsync( executionContext, isGlobal ? ConfigurationHelper.GetCanonicalGlobalSettingsFile(globalSettingsFile) : new FileInfo(settingsFilePath), logger, cancellationToken) @@ -78,38 +81,31 @@ public async Task DeleteConfigurationAsync(string key, bool isGlobal = fal return false; } - try - { - var existingContent = await File.ReadAllTextAsync(settingsFilePath, cancellationToken); - - // Handle empty files or whitespace-only content - if (string.IsNullOrWhiteSpace(existingContent)) - { - return false; - } - - var settings = JsonNode.Parse(existingContent, nodeOptions: null, ConfigurationHelper.ParseOptions)?.AsObject(); + var existingContent = await File.ReadAllTextAsync(settingsFilePath, cancellationToken); - if (settings is null) - { - return false; - } + // Handle empty files or whitespace-only content + if (string.IsNullOrWhiteSpace(existingContent)) + { + return false; + } - ConfigurationHelper.NormalizeSettings(settings); - // Delete using dot notation support and return whether deletion occurred - var deleted = DeleteNestedValue(settings, TemplateSourceConfiguration.ResolveEditKey(settings, key)); + var settings = JsonNode.Parse(existingContent, nodeOptions: null, ConfigurationHelper.ParseOptions)?.AsObject(); + if (settings is null) + { + return false; + } - if (deleted) - { - await ConfigurationHelper.WriteSettingsFileAtomicallyAsync(settingsFilePath, settings, cancellationToken, preserveOwnershipAndAcl: true); - } + ConfigurationHelper.NormalizeSettings(settings); + ResolveKeyParts(keyParts, TemplateSourceConfiguration.ResolveEditKey(settings, string.Join('.', keyParts.Select(part => part.Name)))); + var removedFlat = settings.Remove(string.Join(':', keyParts.Select(part => part.Name))); + var deleted = DeleteNestedValue(settings, keyParts, key, 0) || removedFlat; - return deleted; - } - catch + if (deleted) { - return false; + await ConfigurationHelper.WriteSettingsFileAtomicallyAsync(settingsFilePath, settings, cancellationToken, preserveOwnershipAndAcl: true); } + + return deleted; } public string GetSettingsFilePath(bool isGlobal) @@ -230,42 +226,45 @@ private static async Task LoadConfigurationFromFileAsync(string filePath, Dictio } /// - /// Sets a nested value in a JsonObject using dot notation. - /// Creates intermediate objects as needed and replaces primitives with objects when necessary. + /// Sets a nested value using dot notation and bracketed array indices. + /// Creates intermediate containers as needed and preserves existing arrays. /// Also removes any conflicting flattened keys (colon-separated format) to prevent duplicate key errors. /// - private static void SetNestedValue(JsonObject settings, string key, string value) + private static void SetNestedValue(JsonObject settings, KeyPart[] keyParts, string key, string value) { - // Normalize colon-separated keys to dot notation since both represent - // the same configuration hierarchy (e.g., "features:polyglotSupportEnabled" - // is equivalent to "features.polyglotSupportEnabled") - key = key.Replace(':', '.'); - - var keyParts = key.Split('.'); - // Remove any conflicting flattened keys (e.g., "features:showAllTemplates" when setting "features.showAllTemplates") // This prevents duplicate key errors when loading the configuration - RemoveConflictingFlattenedKeys(settings, keyParts); + RemoveConflictingFlattenedKeys(settings, keyParts.Select(part => part.Name).ToArray()); - var currentObject = settings; + JsonNode current = settings; - // Navigate to the parent object, creating objects as needed for (int i = 0; i < keyParts.Length - 1; i++) { var part = keyParts[i]; + var child = GetChildValue(current, part, key, allowAppend: true); - // If the property doesn't exist or isn't an object, replace it with a new object - if (!currentObject.ContainsKey(part) || currentObject[part] is not JsonObject) + if (keyParts[i + 1].IsArrayIndex) + { + if (child is null) + { + child = new JsonArray(); + SetChildValue(current, part, key, child); + } + else if (child is not JsonArray) + { + throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ConfigCommandStrings.ConfigurationArrayRequired, key)); + } + } + else if (child is not JsonObject and not JsonArray) { - currentObject[part] = new JsonObject(); + child = new JsonObject(); + SetChildValue(current, part, key, child); } - currentObject = currentObject[part]!.AsObject(); + current = child; } - // Set the final value - var finalKey = keyParts[keyParts.Length - 1]; - currentObject[finalKey] = value; + SetChildValue(current, keyParts[^1], key, JsonValue.Create(value)); } /// @@ -282,7 +281,9 @@ private static void RemoveConflictingFlattenedKeys(JsonObject settings, string[] // Also check for partial flattened keys at each level // For example, if we have "a.b.c", we should also check for "a:b" in the root // that might contain a "c" value - for (int i = 1; i < keyParts.Length; i++) + // A single property name is not a flattened key. Removing it here would + // discard existing arrays or scalars before array traversal can validate them. + for (int i = 2; i < keyParts.Length; i++) { var partialKey = string.Join(":", keyParts.Take(i)); if (settings.ContainsKey(partialKey) && settings[partialKey] is not JsonObject) @@ -294,63 +295,43 @@ private static void RemoveConflictingFlattenedKeys(JsonObject settings, string[] } /// - /// Deletes a nested value from a JsonObject using dot notation. - /// Cleans up empty parent objects after deletion. + /// Deletes a nested value, compacting arrays and cleaning up empty parent objects. /// - private static bool DeleteNestedValue(JsonObject settings, string key) + private static bool DeleteNestedValue(JsonNode current, KeyPart[] keyParts, string key, int depth) { - // Normalize colon-separated keys to dot notation - key = key.Replace(':', '.'); - - var keyParts = key.Split('.'); - - // Remove any flat colon-separated key at root level (legacy format) - var flattenedKey = string.Join(":", keyParts); - var removedFlat = settings.Remove(flattenedKey); - - var currentObject = settings; - var objectPath = new List<(JsonObject obj, string key)>(); - - // Navigate to the target value, keeping track of the path - for (int i = 0; i < keyParts.Length - 1; i++) + var part = keyParts[depth]; + if (current is not JsonObject and not JsonArray) { - var part = keyParts[i]; - objectPath.Add((currentObject, part)); + return false; + } - if (!currentObject.ContainsKey(part) || currentObject[part] is not JsonObject) + var child = GetChildValue(current, part, key, allowAppend: false); + if (depth == keyParts.Length - 1) + { + if (current is JsonArray array) { - return removedFlat; // Path doesn't exist, but may have removed flat key + var index = GetArrayIndex(part, key); + if (index >= array.Count) + { + return false; + } + array.RemoveAt(index); + return true; } - currentObject = currentObject[part]!.AsObject(); + return current.AsObject().Remove(part.Name); } - var finalKey = keyParts[keyParts.Length - 1]; - - // Check if the final key exists - if (!currentObject.ContainsKey(finalKey)) + if (child is null || !DeleteNestedValue(child, keyParts, key, depth + 1)) { - return removedFlat; + return false; } - // Remove the final key - currentObject.Remove(finalKey); - - // Clean up empty parent objects, working backwards - for (int i = objectPath.Count - 1; i >= 0; i--) + // Keep empty arrays and array elements: removing them would change the setting's + // type or shift an unrelated element when deleting a property inside an array. + if (child is JsonObject { Count: 0 } && current is JsonObject parent) { - var (parentObject, parentKey) = objectPath[i]; - - // If the current object is empty, remove it from its parent - if (currentObject.Count == 0) - { - parentObject.Remove(parentKey); - currentObject = parentObject; - } - else - { - break; // Stop cleanup if we encounter a non-empty object - } + parent.Remove(part.Name); } return true; @@ -367,21 +348,40 @@ private static void FlattenJsonObject(JsonObject obj, Dictionary var normalizedKey = kvp.Key.Replace(':', '.'); var key = string.IsNullOrEmpty(prefix) ? normalizedKey : $"{prefix}.{normalizedKey}"; - if (kvp.Value is JsonObject nestedObj) - { - FlattenJsonObject(nestedObj, result, key); - } - else if (kvp.Value is not null) + FlattenJsonValue(kvp.Value, result, key); + } + } + + private static void FlattenJsonValue(JsonNode? value, Dictionary result, string key) + { + if (value is JsonObject { Count: > 0 } obj) + { + FlattenJsonObject(obj, result, key); + } + else if (value is JsonArray { Count: > 0 } array) + { + for (var i = 0; i < array.Count; i++) { - result[key] = kvp.Value.ToString(); + var elementKey = $"{key}[{i.ToString(CultureInfo.InvariantCulture)}]"; + if (array[i] is null) + { + result[elementKey] = "null"; + } + else + { + FlattenJsonValue(array[i], result, elementKey); + } } } + else if (value is not null) + { + result[key] = value.ToString(); + } } public Task GetConfigurationAsync(string key, CancellationToken cancellationToken = default) { - // Convert dot notation to colon notation for IConfiguration access - var configKey = key.Replace('.', ':'); + var configKey = string.Join(':', ParseKey(key).Select(part => part.Name)); return Task.FromResult(configuration[configKey]); } @@ -389,7 +389,7 @@ private static void FlattenJsonObject(JsonObject obj, Dictionary { ArgumentNullException.ThrowIfNull(startDirectory); - var configKey = key.Replace('.', ':'); + var configKey = string.Join(':', ParseKey(key).Select(part => part.Name)); // 1. Project-relative local settings: walk up from startDirectory to find the nearest // config file. Most command lookups stop at that file, even when it omits the key, @@ -517,4 +517,109 @@ private static IConfigurationRoot LoadSettingsFileForReading(string filePath) .AddJsonStream(new MemoryStream(bytes)) .Build(); } + + private static KeyPart[] ParseKey(string key) + { + var parts = new List(); + // Paths such as "sources.team.plugins[0]" and "matrix[0][1].name" use + // brackets only for non-negative indices. Dotted numbers remain object + // property names unless traversal reaches an existing JSON array. + foreach (var segment in key.Replace(':', '.').Split('.')) + { + var bracket = segment.IndexOf('['); + var name = bracket < 0 ? segment : segment[..bracket]; + if (name.Length == 0 || name.Contains(']')) + { + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ConfigCommandStrings.ConfigurationKeyInvalid, key), nameof(key)); + } + parts.Add(new KeyPart(name, IsArrayIndex: false)); + + while (bracket >= 0) + { + var end = segment.IndexOf(']', bracket + 1); + if (end < 0 || !int.TryParse(segment.AsSpan(bracket + 1, end - bracket - 1), NumberStyles.None, CultureInfo.InvariantCulture, out var index)) + { + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ConfigCommandStrings.ConfigurationKeyInvalid, key), nameof(key)); + } + parts.Add(new KeyPart(index.ToString(CultureInfo.InvariantCulture), IsArrayIndex: true)); + bracket = end + 1; + if (bracket == segment.Length) + { + break; + } + if (segment[bracket] != '[') + { + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ConfigCommandStrings.ConfigurationKeyInvalid, key), nameof(key)); + } + } + } + + return parts.ToArray(); + } + + private static void ResolveKeyParts(KeyPart[] parts, string resolvedKey) + { + var names = resolvedKey.Split('.'); + for (var i = 0; i < parts.Length; i++) + { + parts[i] = parts[i] with { Name = names[i] }; + } + } + + private static int GetArrayIndex(KeyPart part, string key) + { + if (!int.TryParse(part.Name, NumberStyles.None, CultureInfo.InvariantCulture, out var index)) + { + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ConfigCommandStrings.ConfigurationArrayIndexInvalid, key), nameof(key)); + } + + return index; + } + + private static JsonNode? GetChildValue(JsonNode current, KeyPart part, string key, bool allowAppend) + { + if (current is JsonArray array) + { + var index = GetArrayIndex(part, key); + if (index < array.Count) + { + return array[index]; + } + if (allowAppend && index > array.Count) + { + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ConfigCommandStrings.ConfigurationArrayIndexOutOfRange, index, key, array.Count), nameof(key)); + } + + return null; + } + if (part.IsArrayIndex) + { + throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ConfigCommandStrings.ConfigurationArrayRequired, key)); + } + + return current.AsObject()[part.Name]; + } + + private static void SetChildValue(JsonNode current, KeyPart part, string key, JsonNode value) + { + _ = GetChildValue(current, part, key, allowAppend: true); + if (current is JsonArray array) + { + var index = GetArrayIndex(part, key); + if (index == array.Count) + { + array.Add(value); + } + else + { + array[index] = value; + } + } + else + { + current.AsObject()[part.Name] = value; + } + } + + private readonly record struct KeyPart(string Name, bool IsArrayIndex); } diff --git a/src/Aspire.Cli/Git/GitCommandRunner.cs b/src/Aspire.Cli/Git/GitCommandRunner.cs index 5654f45701f..713996e8c25 100644 --- a/src/Aspire.Cli/Git/GitCommandRunner.cs +++ b/src/Aspire.Cli/Git/GitCommandRunner.cs @@ -269,8 +269,17 @@ internal static string GetSshExecutable(string command) probe.FileName = executable; probe.ArgumentList.Clear(); probe.ArgumentList.Add("-V"); + + return await VerifyOpenSshAsync(probe, cancellationToken) ? executable : null; + } + + internal async Task VerifyOpenSshAsync(ProcessStartInfo probe, CancellationToken cancellationToken) + { + var stopwatch = Stopwatch.StartNew(); + // Allow slow OpenSSH initialization on busy Windows runners without exceeding + // the caller's acquisition deadline or leaving an unbounded probe. var result = await ProcessCaptureRunner.RunAsync( - probe, TimeSpan.FromSeconds(5), + probe, TimeSpan.FromSeconds(30), async (process, token) => { process.StandardInput.Close(); @@ -280,9 +289,11 @@ internal static string GetSshExecutable(string command) return (await stdout + await stderr).Trim(); }, () => null, NullLogger.Instance, cancellationToken); + logger.LogDebug("OpenSSH verification completed after {Elapsed}; exit code {ExitCode}, failure {Failure}, cancelled {Cancelled}.", + stopwatch.Elapsed, result.ExitCode, result.FailureKind, result.Cancelled); cancellationToken.ThrowIfCancellationRequested(); return !result.Cancelled && result.FailureKind is null && result.ExitCode == 0 - && result.Capture?.StartsWith("OpenSSH_", StringComparison.Ordinal) is true ? executable : null; + && result.Capture?.StartsWith("OpenSSH_", StringComparison.Ordinal) is true; } internal static string NormalizeSshPath(string path, string workingDirectory) diff --git a/src/Aspire.Cli/Resources/ConfigCommandStrings.Designer.cs b/src/Aspire.Cli/Resources/ConfigCommandStrings.Designer.cs index 79b3d32535d..71b46a59cce 100644 --- a/src/Aspire.Cli/Resources/ConfigCommandStrings.Designer.cs +++ b/src/Aspire.Cli/Resources/ConfigCommandStrings.Designer.cs @@ -69,6 +69,33 @@ internal static string AvailableFeaturesHeader { } } + /// + /// Looks up a localized string similar to Configuration key '{0}' requires a non-negative integer array index.. + /// + internal static string ConfigurationArrayIndexInvalid { + get { + return ResourceManager.GetString("ConfigurationArrayIndexInvalid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}.. + /// + internal static string ConfigurationArrayIndexOutOfRange { + get { + return ResourceManager.GetString("ConfigurationArrayIndexOutOfRange", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Configuration key '{0}' requires an array, but the existing value is not an array.. + /// + internal static string ConfigurationArrayRequired { + get { + return ResourceManager.GetString("ConfigurationArrayRequired", resourceCulture); + } + } + /// /// Looks up a localized string similar to Configuration '{0}' deleted globally.. /// @@ -87,6 +114,15 @@ internal static string ConfigurationKeyDeletedLocally { } } + /// + /// Looks up a localized string similar to Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices.. + /// + internal static string ConfigurationKeyInvalid { + get { + return ResourceManager.GetString("ConfigurationKeyInvalid", resourceCulture); + } + } + /// /// Looks up a localized string similar to Configuration '{0}' set to '{1}' globally.. /// @@ -124,7 +160,7 @@ internal static string DeleteCommand_GlobalArgumentDescription { } /// - /// Looks up a localized string similar to The configuration key to delete. + /// Looks up a localized string similar to The configuration key to delete. Use dots for nested properties and [index] for array elements.. /// internal static string DeleteCommand_KeyArgumentDescription { get { @@ -178,7 +214,7 @@ internal static string GetCommand_Description { } /// - /// Looks up a localized string similar to The configuration key to retrieve. + /// Looks up a localized string similar to The configuration key to retrieve. Use dots for nested properties and [index] for array elements.. /// internal static string GetCommand_KeyArgumentDescription { get { @@ -358,7 +394,7 @@ internal static string SetCommand_GlobalArgumentDescription { } /// - /// Looks up a localized string similar to The configuration key to set. + /// Looks up a localized string similar to The configuration key to set. Use dots for nested properties and [index] to create or edit array elements.. /// internal static string SetCommand_KeyArgumentDescription { get { diff --git a/src/Aspire.Cli/Resources/ConfigCommandStrings.resx b/src/Aspire.Cli/Resources/ConfigCommandStrings.resx index b615ecc6cbd..7c7aec51443 100644 --- a/src/Aspire.Cli/Resources/ConfigCommandStrings.resx +++ b/src/Aspire.Cli/Resources/ConfigCommandStrings.resx @@ -113,13 +113,13 @@ Get a configuration value - The configuration key to retrieve + The configuration key to retrieve. Use dots for nested properties and [index] for array elements. Set a configuration value - The configuration key to set + The configuration key to set. Use dots for nested properties and [index] to create or edit array elements. The configuration value to set @@ -151,7 +151,23 @@ Delete a configuration value - The configuration key to delete + The configuration key to delete. Use dots for nested properties and [index] for array elements. + + + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + {0} is the configuration key. + + + Configuration key '{0}' requires an array, but the existing value is not an array. + {0} is the configuration key. + + + Configuration key '{0}' requires a non-negative integer array index. + {0} is the configuration key. + + + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + {0} is the requested index, {1} is the configuration key, and {2} is the array length. Delete the configuration value from the global $HOME/.aspire/settings.json instead of the local settings file diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.cs.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.cs.xlf index f16b2efc506..2dd9ba00826 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.cs.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.cs.xlf @@ -7,6 +7,21 @@ Dostupné funkce + + Configuration key '{0}' requires a non-negative integer array index. + Configuration key '{0}' requires a non-negative integer array index. + {0} is the configuration key. + + + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + {0} is the requested index, {1} is the configuration key, and {2} is the array length. + + + Configuration key '{0}' requires an array, but the existing value is not an array. + Configuration key '{0}' requires an array, but the existing value is not an array. + {0} is the configuration key. + Configuration '{0}' deleted globally. Konfigurace {0} byla odstraněna globálně. @@ -17,6 +32,11 @@ Konfigurace {0} byla odstraněna místně. + + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + {0} is the configuration key. + Configuration '{0}' set to '{1}' globally. Konfigurace {0} je globálně nastavená na {1}. @@ -38,8 +58,8 @@ - The configuration key to delete - Konfigurační klíč, který se má odstranit + The configuration key to delete. Use dots for nested properties and [index] for array elements. + Konfigurační klíč, který se má odstranit @@ -68,8 +88,8 @@ - The configuration key to retrieve - Konfigurační klíč, který se má načíst + The configuration key to retrieve. Use dots for nested properties and [index] for array elements. + Konfigurační klíč, který se má načíst @@ -168,8 +188,8 @@ - The configuration key to set - Konfigurační klíč, který se má nastavit + The configuration key to set. Use dots for nested properties and [index] to create or edit array elements. + Konfigurační klíč, který se má nastavit diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.de.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.de.xlf index 3cb4484cd99..20d1e21b8a9 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.de.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.de.xlf @@ -7,6 +7,21 @@ Verfügbare Features + + Configuration key '{0}' requires a non-negative integer array index. + Configuration key '{0}' requires a non-negative integer array index. + {0} is the configuration key. + + + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + {0} is the requested index, {1} is the configuration key, and {2} is the array length. + + + Configuration key '{0}' requires an array, but the existing value is not an array. + Configuration key '{0}' requires an array, but the existing value is not an array. + {0} is the configuration key. + Configuration '{0}' deleted globally. Die Konfiguration „{0}“ wurde global gelöscht. @@ -17,6 +32,11 @@ Die Konfiguration „{0}“ wurde lokal gelöscht. + + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + {0} is the configuration key. + Configuration '{0}' set to '{1}' globally. Die Konfiguration „{0}“ ist global auf „{1}“ festgelegt. @@ -38,8 +58,8 @@ - The configuration key to delete - Der zu löschende Konfigurationsschlüssel. + The configuration key to delete. Use dots for nested properties and [index] for array elements. + Der zu löschende Konfigurationsschlüssel. @@ -68,8 +88,8 @@ - The configuration key to retrieve - Der abzurufende Konfigurationsschlüssel. + The configuration key to retrieve. Use dots for nested properties and [index] for array elements. + Der abzurufende Konfigurationsschlüssel. @@ -168,8 +188,8 @@ - The configuration key to set - Der festzulegende Konfigurationsschlüssel. + The configuration key to set. Use dots for nested properties and [index] to create or edit array elements. + Der festzulegende Konfigurationsschlüssel. diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.es.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.es.xlf index d6e8d6ece12..1427d655699 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.es.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.es.xlf @@ -7,6 +7,21 @@ Características disponibles + + Configuration key '{0}' requires a non-negative integer array index. + Configuration key '{0}' requires a non-negative integer array index. + {0} is the configuration key. + + + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + {0} is the requested index, {1} is the configuration key, and {2} is the array length. + + + Configuration key '{0}' requires an array, but the existing value is not an array. + Configuration key '{0}' requires an array, but the existing value is not an array. + {0} is the configuration key. + Configuration '{0}' deleted globally. La configuración "{0}" se eliminó globalmente. @@ -17,6 +32,11 @@ La configuración "{0}" se eliminó localmente. + + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + {0} is the configuration key. + Configuration '{0}' set to '{1}' globally. Configuración "{0}" establecida en "{1}" globalmente. @@ -38,8 +58,8 @@ - The configuration key to delete - Clave de configuración que se va a eliminar + The configuration key to delete. Use dots for nested properties and [index] for array elements. + Clave de configuración que se va a eliminar @@ -68,8 +88,8 @@ - The configuration key to retrieve - La clave de configuración que se va a recuperar + The configuration key to retrieve. Use dots for nested properties and [index] for array elements. + La clave de configuración que se va a recuperar @@ -168,8 +188,8 @@ - The configuration key to set - Clave de configuración que se va a establecer + The configuration key to set. Use dots for nested properties and [index] to create or edit array elements. + Clave de configuración que se va a establecer diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.fr.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.fr.xlf index 280ec067d91..0231eeae89c 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.fr.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.fr.xlf @@ -7,6 +7,21 @@ Fonctionnalités disponibles + + Configuration key '{0}' requires a non-negative integer array index. + Configuration key '{0}' requires a non-negative integer array index. + {0} is the configuration key. + + + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + {0} is the requested index, {1} is the configuration key, and {2} is the array length. + + + Configuration key '{0}' requires an array, but the existing value is not an array. + Configuration key '{0}' requires an array, but the existing value is not an array. + {0} is the configuration key. + Configuration '{0}' deleted globally. La configuration « {0} » a été supprimée globalement. @@ -17,6 +32,11 @@ La configuration « {0} » a été supprimée localement. + + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + {0} is the configuration key. + Configuration '{0}' set to '{1}' globally. Configuration « {0} » définie sur « {1} » globalement. @@ -38,8 +58,8 @@ - The configuration key to delete - La clé de configuration à supprimer + The configuration key to delete. Use dots for nested properties and [index] for array elements. + La clé de configuration à supprimer @@ -68,8 +88,8 @@ - The configuration key to retrieve - La clé de configuration à récupérer + The configuration key to retrieve. Use dots for nested properties and [index] for array elements. + La clé de configuration à récupérer @@ -168,8 +188,8 @@ - The configuration key to set - La clé de configuration à définir + The configuration key to set. Use dots for nested properties and [index] to create or edit array elements. + La clé de configuration à définir diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.it.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.it.xlf index 20166881f9b..66f2936c564 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.it.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.it.xlf @@ -7,6 +7,21 @@ Funzionalità disponibili + + Configuration key '{0}' requires a non-negative integer array index. + Configuration key '{0}' requires a non-negative integer array index. + {0} is the configuration key. + + + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + {0} is the requested index, {1} is the configuration key, and {2} is the array length. + + + Configuration key '{0}' requires an array, but the existing value is not an array. + Configuration key '{0}' requires an array, but the existing value is not an array. + {0} is the configuration key. + Configuration '{0}' deleted globally. La configurazione '{0}' è stata eliminata a livello globale. @@ -17,6 +32,11 @@ La configurazione '{0}' è stata eliminata a livello locale. + + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + {0} is the configuration key. + Configuration '{0}' set to '{1}' globally. La configurazione '{0}' è impostata su '{1}' a livello globale. @@ -38,8 +58,8 @@ - The configuration key to delete - Chiave di configurazione da eliminare + The configuration key to delete. Use dots for nested properties and [index] for array elements. + Chiave di configurazione da eliminare @@ -68,8 +88,8 @@ - The configuration key to retrieve - Chiave di configurazione da recuperare + The configuration key to retrieve. Use dots for nested properties and [index] for array elements. + Chiave di configurazione da recuperare @@ -168,8 +188,8 @@ - The configuration key to set - Chiave di configurazione da impostare + The configuration key to set. Use dots for nested properties and [index] to create or edit array elements. + Chiave di configurazione da impostare diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ja.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ja.xlf index 25731384ca1..92d782789ef 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ja.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ja.xlf @@ -7,6 +7,21 @@ 使用可能な機能 + + Configuration key '{0}' requires a non-negative integer array index. + Configuration key '{0}' requires a non-negative integer array index. + {0} is the configuration key. + + + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + {0} is the requested index, {1} is the configuration key, and {2} is the array length. + + + Configuration key '{0}' requires an array, but the existing value is not an array. + Configuration key '{0}' requires an array, but the existing value is not an array. + {0} is the configuration key. + Configuration '{0}' deleted globally. 構成 '{0}' がグローバルに削除されました。 @@ -17,6 +32,11 @@ 構成 '{0}' がローカルで削除されました。 + + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + {0} is the configuration key. + Configuration '{0}' set to '{1}' globally. 構成 '{0}' がグローバルに '{1}' に設定されました。 @@ -38,8 +58,8 @@ - The configuration key to delete - 削除する構成キー + The configuration key to delete. Use dots for nested properties and [index] for array elements. + 削除する構成キー @@ -68,8 +88,8 @@ - The configuration key to retrieve - 取得する構成キー + The configuration key to retrieve. Use dots for nested properties and [index] for array elements. + 取得する構成キー @@ -168,8 +188,8 @@ - The configuration key to set - 設定する構成キー + The configuration key to set. Use dots for nested properties and [index] to create or edit array elements. + 設定する構成キー diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ko.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ko.xlf index ebf620c26e2..890dbe66c56 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ko.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ko.xlf @@ -7,6 +7,21 @@ 사용 가능한 기능 + + Configuration key '{0}' requires a non-negative integer array index. + Configuration key '{0}' requires a non-negative integer array index. + {0} is the configuration key. + + + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + {0} is the requested index, {1} is the configuration key, and {2} is the array length. + + + Configuration key '{0}' requires an array, but the existing value is not an array. + Configuration key '{0}' requires an array, but the existing value is not an array. + {0} is the configuration key. + Configuration '{0}' deleted globally. 구성 '{0}'을(를) 전역에서 삭제했습니다. @@ -17,6 +32,11 @@ 구성 '{0}'을(를) 로컬에서 삭제했습니다. + + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + {0} is the configuration key. + Configuration '{0}' set to '{1}' globally. 구성 '{0}'을(를) 전역에서 '{1}'(으)로 설정했습니다. @@ -38,8 +58,8 @@ - The configuration key to delete - 삭제할 구성 키 + The configuration key to delete. Use dots for nested properties and [index] for array elements. + 삭제할 구성 키 @@ -68,8 +88,8 @@ - The configuration key to retrieve - 검색할 구성 키 + The configuration key to retrieve. Use dots for nested properties and [index] for array elements. + 검색할 구성 키 @@ -168,8 +188,8 @@ - The configuration key to set - 설정할 구성 키 + The configuration key to set. Use dots for nested properties and [index] to create or edit array elements. + 설정할 구성 키 diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pl.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pl.xlf index 9e1b93b933b..d16fcc26060 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pl.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pl.xlf @@ -7,6 +7,21 @@ Dostępne funkcje + + Configuration key '{0}' requires a non-negative integer array index. + Configuration key '{0}' requires a non-negative integer array index. + {0} is the configuration key. + + + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + {0} is the requested index, {1} is the configuration key, and {2} is the array length. + + + Configuration key '{0}' requires an array, but the existing value is not an array. + Configuration key '{0}' requires an array, but the existing value is not an array. + {0} is the configuration key. + Configuration '{0}' deleted globally. Konfiguracja „{0}” została usunięta globalnie. @@ -17,6 +32,11 @@ Konfiguracja „{0}” została usunięta lokalnie. + + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + {0} is the configuration key. + Configuration '{0}' set to '{1}' globally. Konfiguracja „{0}” ustawiona globalnie jako „{1}”. @@ -38,8 +58,8 @@ - The configuration key to delete - Klucz konfiguracji do usunięcia + The configuration key to delete. Use dots for nested properties and [index] for array elements. + Klucz konfiguracji do usunięcia @@ -68,8 +88,8 @@ - The configuration key to retrieve - Klucz konfiguracji do pobrania + The configuration key to retrieve. Use dots for nested properties and [index] for array elements. + Klucz konfiguracji do pobrania @@ -168,8 +188,8 @@ - The configuration key to set - Klucz konfiguracji do ustawienia + The configuration key to set. Use dots for nested properties and [index] to create or edit array elements. + Klucz konfiguracji do ustawienia diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pt-BR.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pt-BR.xlf index 80028b087e6..a526f686d25 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pt-BR.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pt-BR.xlf @@ -7,6 +7,21 @@ Recursos disponíveis + + Configuration key '{0}' requires a non-negative integer array index. + Configuration key '{0}' requires a non-negative integer array index. + {0} is the configuration key. + + + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + {0} is the requested index, {1} is the configuration key, and {2} is the array length. + + + Configuration key '{0}' requires an array, but the existing value is not an array. + Configuration key '{0}' requires an array, but the existing value is not an array. + {0} is the configuration key. + Configuration '{0}' deleted globally. A configuração "{0}" foi excluída globalmente. @@ -17,6 +32,11 @@ A configuração "{0}" foi excluída localmente. + + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + {0} is the configuration key. + Configuration '{0}' set to '{1}' globally. A configuração "{0}" foi definida como "{1}" globalmente. @@ -38,8 +58,8 @@ - The configuration key to delete - A chave de configuração a ser excluída + The configuration key to delete. Use dots for nested properties and [index] for array elements. + A chave de configuração a ser excluída @@ -68,8 +88,8 @@ - The configuration key to retrieve - A chave de configuração a ser recuperada + The configuration key to retrieve. Use dots for nested properties and [index] for array elements. + A chave de configuração a ser recuperada @@ -168,8 +188,8 @@ - The configuration key to set - A chave de configuração a ser definida + The configuration key to set. Use dots for nested properties and [index] to create or edit array elements. + A chave de configuração a ser definida diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ru.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ru.xlf index 8fa614f2964..6e03263cbeb 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ru.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ru.xlf @@ -7,6 +7,21 @@ Доступные функции + + Configuration key '{0}' requires a non-negative integer array index. + Configuration key '{0}' requires a non-negative integer array index. + {0} is the configuration key. + + + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + {0} is the requested index, {1} is the configuration key, and {2} is the array length. + + + Configuration key '{0}' requires an array, but the existing value is not an array. + Configuration key '{0}' requires an array, but the existing value is not an array. + {0} is the configuration key. + Configuration '{0}' deleted globally. Конфигурация "{0}" удалена глобально. @@ -17,6 +32,11 @@ Конфигурация "{0}" удалена локально. + + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + {0} is the configuration key. + Configuration '{0}' set to '{1}' globally. Конфигурация "{0}" установлена в значение "{1}" глобально. @@ -38,8 +58,8 @@ - The configuration key to delete - Ключ конфигурации, который следует удалить + The configuration key to delete. Use dots for nested properties and [index] for array elements. + Ключ конфигурации, который следует удалить @@ -68,8 +88,8 @@ - The configuration key to retrieve - Ключ конфигурации, который следует получить + The configuration key to retrieve. Use dots for nested properties and [index] for array elements. + Ключ конфигурации, который следует получить @@ -168,8 +188,8 @@ - The configuration key to set - Ключ конфигурации, для которого следует задать значение + The configuration key to set. Use dots for nested properties and [index] to create or edit array elements. + Ключ конфигурации, для которого следует задать значение diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.tr.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.tr.xlf index 1a1f4a9de81..e35fa9d0262 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.tr.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.tr.xlf @@ -7,6 +7,21 @@ Kullanılabilir özellikler + + Configuration key '{0}' requires a non-negative integer array index. + Configuration key '{0}' requires a non-negative integer array index. + {0} is the configuration key. + + + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + {0} is the requested index, {1} is the configuration key, and {2} is the array length. + + + Configuration key '{0}' requires an array, but the existing value is not an array. + Configuration key '{0}' requires an array, but the existing value is not an array. + {0} is the configuration key. + Configuration '{0}' deleted globally. '{0}' yapılandırması her yerden silindi. @@ -17,6 +32,11 @@ '{0}' yapılandırması yerel olarak silindi. + + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + {0} is the configuration key. + Configuration '{0}' set to '{1}' globally. '{0}' yapılandırması her yerde '{1}' olarak ayarlandı. @@ -38,8 +58,8 @@ - The configuration key to delete - Silinecek yapılandırma anahtarı + The configuration key to delete. Use dots for nested properties and [index] for array elements. + Silinecek yapılandırma anahtarı @@ -68,8 +88,8 @@ - The configuration key to retrieve - Getirilecek yapılandırma anahtarı + The configuration key to retrieve. Use dots for nested properties and [index] for array elements. + Getirilecek yapılandırma anahtarı @@ -168,8 +188,8 @@ - The configuration key to set - Ayarlanacak yapılandırma anahtarı + The configuration key to set. Use dots for nested properties and [index] to create or edit array elements. + Ayarlanacak yapılandırma anahtarı diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hans.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hans.xlf index dd82310c74b..6acb2cccdef 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hans.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hans.xlf @@ -7,6 +7,21 @@ 可用的功能 + + Configuration key '{0}' requires a non-negative integer array index. + Configuration key '{0}' requires a non-negative integer array index. + {0} is the configuration key. + + + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + {0} is the requested index, {1} is the configuration key, and {2} is the array length. + + + Configuration key '{0}' requires an array, but the existing value is not an array. + Configuration key '{0}' requires an array, but the existing value is not an array. + {0} is the configuration key. + Configuration '{0}' deleted globally. 已在全局范围内删除配置 ‘{0}’。 @@ -17,6 +32,11 @@ 已在本地删除配置 ‘{0}’。 + + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + {0} is the configuration key. + Configuration '{0}' set to '{1}' globally. 已在全局范围内将配置 ‘{0}’ 设置为 ‘{1}’。 @@ -38,8 +58,8 @@ - The configuration key to delete - 要删除的配置键 + The configuration key to delete. Use dots for nested properties and [index] for array elements. + 要删除的配置键 @@ -68,8 +88,8 @@ - The configuration key to retrieve - 要检索的配置键 + The configuration key to retrieve. Use dots for nested properties and [index] for array elements. + 要检索的配置键 @@ -168,8 +188,8 @@ - The configuration key to set - 要设置的配置键 + The configuration key to set. Use dots for nested properties and [index] to create or edit array elements. + 要设置的配置键 diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hant.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hant.xlf index ef33bc344b8..b9e0f7adacd 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hant.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hant.xlf @@ -7,6 +7,21 @@ 可用功能 + + Configuration key '{0}' requires a non-negative integer array index. + Configuration key '{0}' requires a non-negative integer array index. + {0} is the configuration key. + + + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + Array index {0} in configuration key '{1}' is out of range. Edit an existing element or append at index {2}. + {0} is the requested index, {1} is the configuration key, and {2} is the array length. + + + Configuration key '{0}' requires an array, but the existing value is not an array. + Configuration key '{0}' requires an array, but the existing value is not an array. + {0} is the configuration key. + Configuration '{0}' deleted globally. 已全域刪除設定 '{0}'。 @@ -17,6 +32,11 @@ 已本機刪除設定 '{0}'。 + + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + Configuration key '{0}' is invalid. Use dots for nested properties and brackets containing a non-negative integer for array indices. + {0} is the configuration key. + Configuration '{0}' set to '{1}' globally. 設定 '{0}' 已在全域設定為 '{1}'。 @@ -38,8 +58,8 @@ - The configuration key to delete - 要刪除的設定金鑰 + The configuration key to delete. Use dots for nested properties and [index] for array elements. + 要刪除的設定金鑰 @@ -68,8 +88,8 @@ - The configuration key to retrieve - 要擷取的設定金鑰 + The configuration key to retrieve. Use dots for nested properties and [index] for array elements. + 要擷取的設定金鑰 @@ -168,8 +188,8 @@ - The configuration key to set - 要設定的設定金鑰 + The configuration key to set. Use dots for nested properties and [index] to create or edit array elements. + 要設定的設定金鑰 diff --git a/tests/Aspire.Cli.Tests/Commands/ConfigCommandTests.cs b/tests/Aspire.Cli.Tests/Commands/ConfigCommandTests.cs index 0b2aad9dbbb..e275354c444 100644 --- a/tests/Aspire.Cli.Tests/Commands/ConfigCommandTests.cs +++ b/tests/Aspire.Cli.Tests/Commands/ConfigCommandTests.cs @@ -426,6 +426,65 @@ public async Task ConfigGetCommand_WithNonExistentKey_ReturnsError() Assert.Equal(10, exitCode); } + [Fact] + public async Task ConfigCommands_BracketArrayPathsRoundTrip() + { + using var workspace = TemporaryWorkspace.CreateForCli(outputHelper); + var settingsPath = Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName); + await File.WriteAllTextAsync(settingsPath, """{"plugins":["aspire","other"]}"""); + var services = CliTestHelper.CreateServiceCollection(workspace, outputHelper); + using var provider = services.BuildServiceProvider(); + var command = provider.GetRequiredService(); + + Assert.Equal(CliExitCodes.Success, await command.Parse("config set plugins[0] deployment").InvokeAsync().DefaultTimeout()); + + var interaction = new TestInteractionService(); + var readerServices = CliTestHelper.CreateServiceCollection(workspace, outputHelper, + options => options.InteractionServiceFactory = _ => interaction); + using var readerProvider = readerServices.BuildServiceProvider(); + var readerCommand = readerProvider.GetRequiredService(); + Assert.Equal(CliExitCodes.Success, await readerCommand.Parse("config get plugins[0]").InvokeAsync().DefaultTimeout()); + Assert.Equal(["deployment"], interaction.DisplayedPlainText); + Assert.Equal(CliExitCodes.Success, await readerCommand.Parse("config delete plugins[0]").InvokeAsync().DefaultTimeout()); + + await Verify(await File.ReadAllTextAsync(settingsPath), "json"); + } + + [Theory] + [InlineData("config set plugins[2] deployment")] + [InlineData("config set plugins[-1] deployment")] + [InlineData("config get plugins[-1]")] + [InlineData("config delete plugins[-1]")] + [InlineData("config delete custom[0]")] + [InlineData("config set templateSources[0] deployment")] + [InlineData("config set templateSources.team.repository[0] deployment")] + public async Task ConfigCommands_InvalidArrayPathsReportErrorsAndPreserveFile(string commandLine) + { + using var workspace = TemporaryWorkspace.CreateForCli(outputHelper); + var settingsPath = Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName); + const string original = """ + { + "plugins": ["aspire"], + "custom": {"0": "value"}, + "templateSources": { + "team": {"repository": "https://github.com/example/team"} + } + } + """; + await File.WriteAllTextAsync(settingsPath, original); + var interaction = new TestInteractionService(); + var services = CliTestHelper.CreateServiceCollection(workspace, outputHelper, + options => options.InteractionServiceFactory = _ => interaction); + using var provider = services.BuildServiceProvider(); + var command = provider.GetRequiredService(); + + Assert.Equal(CliExitCodes.InvalidCommand, await command.Parse(commandLine).InvokeAsync().DefaultTimeout()); + + Assert.Single(interaction.DisplayedErrors); + Assert.Empty(interaction.DisplayedSuccess); + Assert.Equal(original, await File.ReadAllTextAsync(settingsPath)); + } + [Fact] public async Task ConfigDeleteCommand_WithFlatKey_RemovesValue() { diff --git a/tests/Aspire.Cli.Tests/Configuration/ConfigurationServiceTests.cs b/tests/Aspire.Cli.Tests/Configuration/ConfigurationServiceTests.cs index 83297ce5a0f..04609f6bc04 100644 --- a/tests/Aspire.Cli.Tests/Configuration/ConfigurationServiceTests.cs +++ b/tests/Aspire.Cli.Tests/Configuration/ConfigurationServiceTests.cs @@ -511,6 +511,251 @@ public async Task SetConfigurationAsync_SetsNestedValues() Assert.Contains("MyApp/MyApp.csproj", result); } + [Theory] + [InlineData("skillSources.team.plugins[0]", false)] + [InlineData("skillSources.team.plugins.0", false)] + [InlineData("skillSources:team:plugins:0", false)] + [InlineData("skillSources.team.plugins[0]", true)] + [InlineData("skillSources.team.plugins.0", true)] + [InlineData("skillSources:team:plugins:0", true)] + public async Task SetConfigurationAsync_EditsArrayAndPreservesOtherEntries(string key, bool isGlobal) + { + using var workspace = TemporaryWorkspace.CreateForCli(outputHelper); + const string original = """ + { + "skillSources": { + "team": { + "repository": "example/team", + "plugins": ["aspire", "other"] + } + }, + "channel": "daily" + } + """; + var (service, localPath) = CreateService(workspace, original); + var settingsPath = isGlobal ? service.GetSettingsFilePath(isGlobal: true) : localPath; + if (isGlobal) + { + await File.WriteAllTextAsync(settingsPath, original); + } + + await service.SetConfigurationAsync(key, "deployment", isGlobal); + + await Verify(await File.ReadAllTextAsync(settingsPath), "json").UseParameters(key, isGlobal); + var loaded = AspireConfigFile.Load(Path.GetDirectoryName(settingsPath)!); + Assert.NotNull(loaded?.ExtensionData); + var plugins = loaded.ExtensionData["skillSources"].GetProperty("team").GetProperty("plugins"); + var pluginNames = plugins.Deserialize(); + Assert.NotNull(pluginNames); + Assert.Equal(["deployment", "other"], pluginNames); + } + + [Theory] + [InlineData("{}")] + [InlineData("""{"plugins":null}""")] + public async Task SetConfigurationAsync_CreatesArrayAndAppendsWithoutGaps(string original) + { + using var workspace = TemporaryWorkspace.CreateForCli(outputHelper); + var (service, settingsPath) = CreateService(workspace, original); + + await service.SetConfigurationAsync("plugins[0]", "aspire"); + await service.SetConfigurationAsync("plugins[1]", "other"); + await service.SetConfigurationAsync("plugins.2", "deployment"); + + await Verify(await File.ReadAllTextAsync(settingsPath), "json").UseParameters(original); + } + + [Fact] + public async Task SetConfigurationAsync_CreatesNestedArraysAndObjects() + { + using var workspace = TemporaryWorkspace.CreateForCli(outputHelper); + var (service, settingsPath) = CreateService(workspace, "{}"); + + await service.SetConfigurationAsync("matrix[0][0].name", "first"); + await service.SetConfigurationAsync("matrix[0][1].name", "second"); + await service.SetConfigurationAsync("matrix.0.0.name", "updated"); + + await Verify(await File.ReadAllTextAsync(settingsPath), "json"); + } + + [Fact] + public async Task SetConfigurationAsync_NumericPropertiesRemainObjects() + { + using var workspace = TemporaryWorkspace.CreateForCli(outputHelper); + var (service, settingsPath) = CreateService(workspace, "{}"); + + await service.SetConfigurationAsync("custom.0", "first"); + await service.SetConfigurationAsync("custom:1", "second"); + await service.SetConfigurationAsync("custom.0", "updated"); + + await Verify(await File.ReadAllTextAsync(settingsPath), "json"); + } + + [Theory] + [InlineData("plugins[2]")] + [InlineData("plugins.2")] + [InlineData("plugins[-1]")] + [InlineData("plugins.-1")] + [InlineData("plugins[2147483648]")] + [InlineData("plugins.2147483648")] + [InlineData("plugins.name")] + [InlineData("plugins[]")] + [InlineData("plugins[first]")] + [InlineData("plugins[0")] + [InlineData("plugins[0]suffix")] + [InlineData("plugins[0]]")] + [InlineData("plugins.[0]")] + [InlineData("plugins..name")] + [InlineData("")] + public async Task SetConfigurationAsync_InvalidArrayPathPreservesFile(string key) + { + using var workspace = TemporaryWorkspace.CreateForCli(outputHelper); + const string original = """ + { + // Keep comments on rejected edits. + "plugins": ["aspire"], + "channel": "daily" + } + """; + var (service, settingsPath) = CreateService(workspace, original); + + await Assert.ThrowsAsync(() => service.SetConfigurationAsync(key, "deployment")); + + Assert.Equal(original, await File.ReadAllTextAsync(settingsPath)); + } + + [Theory] + [InlineData("{}")] + [InlineData("""{"0":"aspire"}""")] + [InlineData("\"aspire\"")] + [InlineData("true")] + public async Task SetConfigurationAsync_BracketIndexDoesNotReplaceNonArray(string value) + { + using var workspace = TemporaryWorkspace.CreateForCli(outputHelper); + var original = $$"""{"plugins":{{value}},"channel":"daily"}"""; + var (service, settingsPath) = CreateService(workspace, original); + + await Assert.ThrowsAsync(() => service.SetConfigurationAsync("plugins[0]", "deployment")); + + Assert.Equal(original, await File.ReadAllTextAsync(settingsPath)); + } + + [Fact] + public async Task SetConfigurationAsync_RejectsGapInNewArrayWithoutCreatingFile() + { + using var workspace = TemporaryWorkspace.CreateForCli(outputHelper); + var (service, _) = CreateService(workspace); + var settingsPath = service.GetSettingsFilePath(isGlobal: true); + + await Assert.ThrowsAsync(() => service.SetConfigurationAsync("plugins[1]", "deployment", isGlobal: true)); + + Assert.False(File.Exists(settingsPath)); + } + + [Theory] + [InlineData("plugins[0]", false)] + [InlineData("plugins.0", false)] + [InlineData("plugins:0", false)] + [InlineData("plugins[0]", true)] + public async Task DeleteConfigurationAsync_RemovesArrayElementAndCompactsIndices(string key, bool isGlobal) + { + using var workspace = TemporaryWorkspace.CreateForCli(outputHelper); + const string original = """{"plugins":["aspire","other"],"channel":"daily"}"""; + var (service, localPath) = CreateService(workspace, original); + var settingsPath = isGlobal ? service.GetSettingsFilePath(isGlobal: true) : localPath; + if (isGlobal) + { + await File.WriteAllTextAsync(settingsPath, original); + } + + Assert.True(await service.DeleteConfigurationAsync(key, isGlobal)); + + await Verify(await File.ReadAllTextAsync(settingsPath), "json").UseParameters(key, isGlobal); + } + + [Fact] + public async Task DeleteConfigurationAsync_PreservesEmptyArraysAndArrayElements() + { + using var workspace = TemporaryWorkspace.CreateForCli(outputHelper); + var (service, settingsPath) = CreateService(workspace, """ + { + "plugins": ["aspire"], + "rows": [{"nested": {"name": "first"}}, {"name": "second"}] + } + """); + + Assert.True(await service.DeleteConfigurationAsync("plugins[0]")); + Assert.True(await service.DeleteConfigurationAsync("rows[0].nested.name")); + + await Verify(await File.ReadAllTextAsync(settingsPath), "json"); + } + + [Theory] + [InlineData("plugins[1]")] + [InlineData("plugins.1")] + [InlineData("missing[0]")] + public async Task DeleteConfigurationAsync_MissingArrayElementPreservesFile(string key) + { + using var workspace = TemporaryWorkspace.CreateForCli(outputHelper); + const string original = """{"plugins":["aspire"]}"""; + var (service, settingsPath) = CreateService(workspace, original); + + Assert.False(await service.DeleteConfigurationAsync(key)); + + Assert.Equal(original, await File.ReadAllTextAsync(settingsPath)); + } + + [Fact] + public async Task DeleteConfigurationAsync_InvalidArrayPathPreservesFileAndThrows() + { + using var workspace = TemporaryWorkspace.CreateForCli(outputHelper); + const string original = """{"plugins":["aspire"],"custom":{"0":"value"}}"""; + var (service, settingsPath) = CreateService(workspace, original); + + await Assert.ThrowsAsync(() => service.DeleteConfigurationAsync("plugins[-1]")); + await Assert.ThrowsAsync(() => service.DeleteConfigurationAsync("custom[0]")); + + Assert.Equal(original, await File.ReadAllTextAsync(settingsPath)); + } + + [Theory] + [InlineData("matrix[0][1].name")] + [InlineData("matrix.0.1.name")] + [InlineData("matrix:0:1:name")] + [InlineData("matrix[00][01].name")] + public async Task GetConfigurationAsync_ReadsArrayPaths(string key) + { + using var workspace = TemporaryWorkspace.CreateForCli(outputHelper); + var (service, settingsPath) = CreateService(workspace, """ + {"matrix": [[{"name": "first"}, {"name": "second"}]]} + """); + var configuration = new ConfigurationBuilder().AddJsonFile(settingsPath).Build(); + var reader = new ConfigurationService(configuration, workspace.CreateExecutionContext(), + new FileInfo(service.GetSettingsFilePath(isGlobal: true)), NullLogger.Instance); + + Assert.Equal("second", await reader.GetConfigurationAsync(key)); + Assert.Equal("second", await reader.GetConfigurationFromDirectoryAsync(key, workspace.WorkspaceRoot)); + } + + [Fact] + public async Task GetLocalConfigurationAsync_FlattensArraysWithBracketIndices() + { + using var workspace = TemporaryWorkspace.CreateForCli(outputHelper); + var (service, _) = CreateService(workspace, """ + { + "plugins": [null, "aspire", null, "other", null], + "matrix": [[{"name": "first"}, null], null], + "nullOnly": [null], + "nullProperty": null, + "custom": {"0": "numeric property"}, + "emptyArray": [], + "emptyObject": {} + } + """); + + await Verify(await service.GetLocalConfigurationAsync()); + } + [Fact] public async Task SetConfigurationAsync_WritesBooleanStringAsJsonString() { diff --git a/tests/Aspire.Cli.Tests/Git/GitCommandRunnerTests.Authentication.cs b/tests/Aspire.Cli.Tests/Git/GitCommandRunnerTests.Authentication.cs index c0fb84324f3..55000b8a33a 100644 --- a/tests/Aspire.Cli.Tests/Git/GitCommandRunnerTests.Authentication.cs +++ b/tests/Aspire.Cli.Tests/Git/GitCommandRunnerTests.Authentication.cs @@ -232,6 +232,50 @@ public async Task ConfigureUnattendedSsh_VerifiesOpenSshAndAppliesBatchModeAfter Assert.Equal(configuration, await File.ReadAllTextAsync(config)); } + [Fact] + public async Task VerifyOpenSshAsync_AllowsSlowStartup() + { + var probe = CreateShellStartInfo( + "sleep 6; printf 'OpenSSH_test' >&2", + "Start-Sleep -Seconds 6; [Console]::Error.Write('OpenSSH_test')"); + probe.RedirectStandardInput = true; + + Assert.True(await CreateRunner().VerifyOpenSshAsync(probe, TestContext.Current.CancellationToken)); + } + + [Theory] + [InlineData("OpenSSH_test", 0, true)] + [InlineData("OpenSSH_test", 1, false)] + [InlineData("not OpenSSH", 0, false)] + public async Task VerifyOpenSshAsync_RequiresSuccessfulOpenSshBanner(string banner, int exitCode, bool expected) + { + var probe = CreateShellStartInfo( + $"printf '%s' '{banner}' >&2; exit {exitCode}", + $"[Console]::Error.Write('{banner}'); exit {exitCode}"); + probe.RedirectStandardInput = true; + + Assert.Equal(expected, await CreateRunner().VerifyOpenSshAsync(probe, TestContext.Current.CancellationToken)); + } + + [Fact] + public async Task VerifyOpenSshAsync_HonorsCancellation() + { + var probe = CreateShellStartInfo("sleep 60", "Start-Sleep -Seconds 60"); + probe.RedirectStandardInput = true; + using var cancellation = CancellationTokenSource.CreateLinkedTokenSource(TestContext.Current.CancellationToken); + cancellation.CancelAfter(TimeSpan.FromMilliseconds(100)); + + await Assert.ThrowsAnyAsync(() => CreateRunner().VerifyOpenSshAsync(probe, cancellation.Token)); + } + + [Fact] + [RequiresTools(["git", "ssh"])] + public async Task ConfigureUnattendedSsh_VerifiesOpenSshUnderConcurrentStartup() + { + await Task.WhenAll(Enumerable.Range(0, 16).Select(_ => + ConfigureUnattendedSsh_VerifiesOpenSshAndAppliesBatchModeAfterUrlRewrites(false, "GIT_SSH_COMMAND"))); + } + [Fact] [RequiresTools(["git", "ssh"])] public async Task ConfigureUnattendedSsh_RelativePathEntriesUseGitDirectoryBeforeAbsoluteFallback() diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigCommandTests.ConfigCommands_BracketArrayPathsRoundTrip.verified.json b/tests/Aspire.Cli.Tests/Snapshots/ConfigCommandTests.ConfigCommands_BracketArrayPathsRoundTrip.verified.json new file mode 100644 index 00000000000..b00c8d014ea --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigCommandTests.ConfigCommands_BracketArrayPathsRoundTrip.verified.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + "other" + ] +} diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.DeleteConfigurationAsync_PreservesEmptyArraysAndArrayElements.verified.json b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.DeleteConfigurationAsync_PreservesEmptyArraysAndArrayElements.verified.json new file mode 100644 index 00000000000..6863aab5558 --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.DeleteConfigurationAsync_PreservesEmptyArraysAndArrayElements.verified.json @@ -0,0 +1,9 @@ +{ + "plugins": [], + "rows": [ + {}, + { + "name": "second" + } + ] +} diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.DeleteConfigurationAsync_RemovesArrayElementAndCompactsIndices_key=plugins-0_isGlobal=False.verified.json b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.DeleteConfigurationAsync_RemovesArrayElementAndCompactsIndices_key=plugins-0_isGlobal=False.verified.json new file mode 100644 index 00000000000..aa3405c1544 --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.DeleteConfigurationAsync_RemovesArrayElementAndCompactsIndices_key=plugins-0_isGlobal=False.verified.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + "other" + ], + "channel": "daily" +} diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.DeleteConfigurationAsync_RemovesArrayElementAndCompactsIndices_key=plugins.0_isGlobal=False.verified.json b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.DeleteConfigurationAsync_RemovesArrayElementAndCompactsIndices_key=plugins.0_isGlobal=False.verified.json new file mode 100644 index 00000000000..aa3405c1544 --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.DeleteConfigurationAsync_RemovesArrayElementAndCompactsIndices_key=plugins.0_isGlobal=False.verified.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + "other" + ], + "channel": "daily" +} diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.DeleteConfigurationAsync_RemovesArrayElementAndCompactsIndices_key=plugins[0]_isGlobal=False.verified.json b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.DeleteConfigurationAsync_RemovesArrayElementAndCompactsIndices_key=plugins[0]_isGlobal=False.verified.json new file mode 100644 index 00000000000..aa3405c1544 --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.DeleteConfigurationAsync_RemovesArrayElementAndCompactsIndices_key=plugins[0]_isGlobal=False.verified.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + "other" + ], + "channel": "daily" +} diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.DeleteConfigurationAsync_RemovesArrayElementAndCompactsIndices_key=plugins[0]_isGlobal=True.verified.json b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.DeleteConfigurationAsync_RemovesArrayElementAndCompactsIndices_key=plugins[0]_isGlobal=True.verified.json new file mode 100644 index 00000000000..aa3405c1544 --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.DeleteConfigurationAsync_RemovesArrayElementAndCompactsIndices_key=plugins[0]_isGlobal=True.verified.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + "other" + ], + "channel": "daily" +} diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.GetLocalConfigurationAsync_FlattensArraysWithBracketIndices.verified.txt b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.GetLocalConfigurationAsync_FlattensArraysWithBracketIndices.verified.txt new file mode 100644 index 00000000000..113cbedc441 --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.GetLocalConfigurationAsync_FlattensArraysWithBracketIndices.verified.txt @@ -0,0 +1,14 @@ +{ + custom.0: numeric property, + emptyArray: [], + emptyObject: {}, + matrix[0][0].name: first, + matrix[0][1]: null, + matrix[1]: null, + nullOnly[0]: null, + plugins[0]: null, + plugins[1]: aspire, + plugins[2]: null, + plugins[3]: other, + plugins[4]: null +} \ No newline at end of file diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_CreatesArrayAndAppendsWithoutGaps_original={-plugins--null}.verified.json b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_CreatesArrayAndAppendsWithoutGaps_original={-plugins--null}.verified.json new file mode 100644 index 00000000000..b6b92596050 --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_CreatesArrayAndAppendsWithoutGaps_original={-plugins--null}.verified.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + "aspire", + "other", + "deployment" + ] +} diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_CreatesArrayAndAppendsWithoutGaps_original={}.verified.json b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_CreatesArrayAndAppendsWithoutGaps_original={}.verified.json new file mode 100644 index 00000000000..b6b92596050 --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_CreatesArrayAndAppendsWithoutGaps_original={}.verified.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + "aspire", + "other", + "deployment" + ] +} diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_CreatesNestedArraysAndObjects.verified.json b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_CreatesNestedArraysAndObjects.verified.json new file mode 100644 index 00000000000..33b75150329 --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_CreatesNestedArraysAndObjects.verified.json @@ -0,0 +1,12 @@ +{ + "matrix": [ + [ + { + "name": "updated" + }, + { + "name": "second" + } + ] + ] +} diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources-team-plugins-0_isGlobal=False.verified.json b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources-team-plugins-0_isGlobal=False.verified.json new file mode 100644 index 00000000000..51da5acc9bc --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources-team-plugins-0_isGlobal=False.verified.json @@ -0,0 +1,12 @@ +{ + "skillSources": { + "team": { + "repository": "example/team", + "plugins": [ + "deployment", + "other" + ] + } + }, + "channel": "daily" +} diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources-team-plugins-0_isGlobal=True.verified.json b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources-team-plugins-0_isGlobal=True.verified.json new file mode 100644 index 00000000000..51da5acc9bc --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources-team-plugins-0_isGlobal=True.verified.json @@ -0,0 +1,12 @@ +{ + "skillSources": { + "team": { + "repository": "example/team", + "plugins": [ + "deployment", + "other" + ] + } + }, + "channel": "daily" +} diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources.team.plugins.0_isGlobal=False.verified.json b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources.team.plugins.0_isGlobal=False.verified.json new file mode 100644 index 00000000000..51da5acc9bc --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources.team.plugins.0_isGlobal=False.verified.json @@ -0,0 +1,12 @@ +{ + "skillSources": { + "team": { + "repository": "example/team", + "plugins": [ + "deployment", + "other" + ] + } + }, + "channel": "daily" +} diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources.team.plugins.0_isGlobal=True.verified.json b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources.team.plugins.0_isGlobal=True.verified.json new file mode 100644 index 00000000000..51da5acc9bc --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources.team.plugins.0_isGlobal=True.verified.json @@ -0,0 +1,12 @@ +{ + "skillSources": { + "team": { + "repository": "example/team", + "plugins": [ + "deployment", + "other" + ] + } + }, + "channel": "daily" +} diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources.team.plugins[0]_isGlobal=False.verified.json b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources.team.plugins[0]_isGlobal=False.verified.json new file mode 100644 index 00000000000..51da5acc9bc --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources.team.plugins[0]_isGlobal=False.verified.json @@ -0,0 +1,12 @@ +{ + "skillSources": { + "team": { + "repository": "example/team", + "plugins": [ + "deployment", + "other" + ] + } + }, + "channel": "daily" +} diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources.team.plugins[0]_isGlobal=True.verified.json b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources.team.plugins[0]_isGlobal=True.verified.json new file mode 100644 index 00000000000..51da5acc9bc --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_EditsArrayAndPreservesOtherEntries_key=skillSources.team.plugins[0]_isGlobal=True.verified.json @@ -0,0 +1,12 @@ +{ + "skillSources": { + "team": { + "repository": "example/team", + "plugins": [ + "deployment", + "other" + ] + } + }, + "channel": "daily" +} diff --git a/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_NumericPropertiesRemainObjects.verified.json b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_NumericPropertiesRemainObjects.verified.json new file mode 100644 index 00000000000..e4f8a65b226 --- /dev/null +++ b/tests/Aspire.Cli.Tests/Snapshots/ConfigurationServiceTests.SetConfigurationAsync_NumericPropertiesRemainObjects.verified.json @@ -0,0 +1,6 @@ +{ + "custom": { + "0": "updated", + "1": "second" + } +}