Dataset Viewer
repo
stringclasses 17
values | instance_id
stringlengths 10
43
| base_commit
stringlengths 40
40
| patch
stringlengths 530
154k
| test_patch
stringlengths 377
76.4k
β | problem_statement
stringlengths 97
33k
| hints_text
stringlengths 3
18.4k
β | created_at
stringdate 2020-06-16 21:09:47
2025-04-20 13:41:07
| version
stringclasses 4
values | FAIL_TO_PASS
stringlengths 2
3.71k
| PASS_TO_PASS
stringlengths 2
5.8k
|
|---|---|---|---|---|---|---|---|---|---|---|
ardalis/CleanArchitecture
|
ardalis__cleanarchitecture-546
|
8073cf3eb58654d67baeab966e530ae69e4a9378
|
diff --git a/src/Clean.Architecture.Web/ApiModels/ProjectDTO.cs b/src/Clean.Architecture.Web/ApiModels/ProjectDTO.cs
index 373e25fdb..c5342328c 100644
--- a/src/Clean.Architecture.Web/ApiModels/ProjectDTO.cs
+++ b/src/Clean.Architecture.Web/ApiModels/ProjectDTO.cs
@@ -15,7 +15,7 @@ public ProjectDTO(int id, string name, List<ToDoItemDTO>? items = null) : base(n
// Creation DTOs should not include an ID if the ID will be generated by the back end
public class CreateProjectDTO
{
- protected CreateProjectDTO(string name)
+ public CreateProjectDTO(string name)
{
Name = name;
}
|
diff --git a/tests/Clean.Architecture.FunctionalTests/ControllerApis/ApiProjectsControllerList.cs b/tests/Clean.Architecture.FunctionalTests/ControllerApis/ApiProjectsControllerList.cs
index f8d5de85c..df65af509 100644
--- a/tests/Clean.Architecture.FunctionalTests/ControllerApis/ApiProjectsControllerList.cs
+++ b/tests/Clean.Architecture.FunctionalTests/ControllerApis/ApiProjectsControllerList.cs
@@ -1,6 +1,8 @@
-ο»Ώusing Ardalis.HttpClientTestExtensions;
+ο»Ώusing System.Text;
+using Ardalis.HttpClientTestExtensions;
using Clean.Architecture.Web;
using Clean.Architecture.Web.ApiModels;
+using Newtonsoft.Json;
using Xunit;
namespace Clean.Architecture.FunctionalTests.ControllerApis;
@@ -23,4 +25,13 @@ public async Task ReturnsOneProject()
Assert.Single(result);
Assert.Contains(result, i => i.Name == SeedData.TestProject1.Name);
}
+
+ [Fact]
+ public async Task CreateProject()
+ {
+ string projectName = "Test Project 2";
+ var result = await _client.PostAndDeserializeAsync<ProjectDTO>("/api/projects", new StringContent(JsonConvert.SerializeObject(new CreateProjectDTO(projectName)), Encoding.UTF8, "application/json"));
+ Assert.NotNull(result);
+ Assert.Equal(projectName, result.Name);
+ }
}
|
Attempting to create a new project through the API results in an error regarding the 'CreateProjectDTO' interface.
<!-- β οΈβ οΈ Do Not Delete This! bug_report_template β οΈβ οΈ -->
<!-- π Search existing issues to avoid creating duplicates. -->
It's not possible to create a new project using the endpoint `[POST]/api/Projects`.
When trying, it gives an error: `Could not create an instance of type Clean.Architecture.Web.ApiModels.CreateProjectDTO. Type is an interface or abstract class and cannot be instantiated. Path 'name', line 2, position 9.`



| null |
2023-05-01T16:18:24Z
|
0.1
|
['Clean.Architecture.FunctionalTests.ControllerApis.ProjectCreate.CreateProject']
|
['Clean.Architecture.FunctionalTests.ControllerApis.ProjectCreate.ReturnsOneProject']
|
ardalis/CleanArchitecture
|
ardalis__cleanarchitecture-530
|
f041a4e1eee6438a7249e4ff687969b5ce728c62
|
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 402b2d6ab..a4e72e15f 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -16,6 +16,7 @@
<PackageVersion Include="FastEndpoints.ApiExplorer" Version="2.0.1" />
<PackageVersion Include="FastEndpoints.Swagger" Version="5.5.0" />
<PackageVersion Include="FastEndpoints.Swagger.Swashbuckle" Version="2.0.1" />
+ <PackageVersion Include="FluentAssertions" Version="6.10.0" />
<PackageVersion Include="MediatR" Version="12.0.1" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.4" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.4" />
diff --git a/src/Clean.Architecture.Core/ProjectAggregate/Specifications/ContributorByIdSpec.cs b/src/Clean.Architecture.Core/ContributorAggregate/Specifications/ContributorByIdSpec.cs
similarity index 68%
rename from src/Clean.Architecture.Core/ProjectAggregate/Specifications/ContributorByIdSpec.cs
rename to src/Clean.Architecture.Core/ContributorAggregate/Specifications/ContributorByIdSpec.cs
index e7e561691..2529afe63 100644
--- a/src/Clean.Architecture.Core/ProjectAggregate/Specifications/ContributorByIdSpec.cs
+++ b/src/Clean.Architecture.Core/ContributorAggregate/Specifications/ContributorByIdSpec.cs
@@ -1,7 +1,6 @@
ο»Ώusing Ardalis.Specification;
-using Clean.Architecture.Core.ContributorAggregate;
-namespace Clean.Architecture.Core.ProjectAggregate.Specifications;
+namespace Clean.Architecture.Core.ContributorAggregate.Specifications;
public class ContributorByIdSpec : Specification<Contributor>, ISingleResultSpecification
{
diff --git a/src/Clean.Architecture.Core/Interfaces/IDeleteContributorService.cs b/src/Clean.Architecture.Core/Interfaces/IDeleteContributorService.cs
index 7f9434d87..54fe303ab 100644
--- a/src/Clean.Architecture.Core/Interfaces/IDeleteContributorService.cs
+++ b/src/Clean.Architecture.Core/Interfaces/IDeleteContributorService.cs
@@ -1,8 +1,10 @@
-using Ardalis.Result;
+ο»Ώusing Ardalis.Result;
namespace Clean.Architecture.Core.Interfaces;
public interface IDeleteContributorService
{
- public Task<Result> DeleteContributor(int contributorId);
+ // This service and method exist to provide a place in which to fire domain events
+ // when deleting this aggregate root entity
+ public Task<Result> DeleteContributor(int contributorId);
}
diff --git a/src/Clean.Architecture.Web/Endpoints/ContributorEndpoints/GetById.cs b/src/Clean.Architecture.Web/Endpoints/ContributorEndpoints/GetById.cs
index 8b35be410..042c99fa4 100644
--- a/src/Clean.Architecture.Web/Endpoints/ContributorEndpoints/GetById.cs
+++ b/src/Clean.Architecture.Web/Endpoints/ContributorEndpoints/GetById.cs
@@ -1,5 +1,5 @@
ο»Ώusing Clean.Architecture.Core.ContributorAggregate;
-using Clean.Architecture.Core.ProjectAggregate.Specifications;
+using Clean.Architecture.Core.ContributorAggregate.Specifications;
using Clean.Architecture.SharedKernel.Interfaces;
using FastEndpoints;
diff --git a/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/CreateToDoItem.CreateToDoItemRequest.cs b/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/CreateToDoItem.CreateToDoItemRequest.cs
new file mode 100644
index 000000000..e0b11f085
--- /dev/null
+++ b/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/CreateToDoItem.CreateToDoItemRequest.cs
@@ -0,0 +1,19 @@
+ο»Ώusing System.ComponentModel.DataAnnotations;
+using Microsoft.AspNetCore.Mvc;
+
+namespace Clean.Architecture.Web.Endpoints.ProjectEndpoints;
+
+public class CreateToDoItemRequest
+{
+ public const string Route = "/Projects/{ProjectId:int}/ToDoItems";
+ public static string BuildRoute(int projectId) => Route.Replace("{ProjectId:int}", projectId.ToString());
+
+ [Required]
+ [FromRoute]
+ public int ProjectId { get; set; }
+
+ [Required]
+ public string? Title { get; set; }
+ public string? Description { get; set; }
+ public int? ContributorId { get; set; }
+}
diff --git a/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/CreateToDoItem.cs b/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/CreateToDoItem.cs
new file mode 100644
index 000000000..55c2c9c50
--- /dev/null
+++ b/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/CreateToDoItem.cs
@@ -0,0 +1,54 @@
+ο»Ώusing Ardalis.ApiEndpoints;
+using Clean.Architecture.Core.ProjectAggregate;
+using Clean.Architecture.Core.ProjectAggregate.Specifications;
+using Clean.Architecture.SharedKernel.Interfaces;
+using Microsoft.AspNetCore.Mvc;
+using Swashbuckle.AspNetCore.Annotations;
+
+namespace Clean.Architecture.Web.Endpoints.ProjectEndpoints;
+
+public class CreateToDoItem : EndpointBaseAsync
+ .WithRequest<CreateToDoItemRequest>
+ .WithActionResult
+{
+ private readonly IRepository<Project> _repository;
+
+ public CreateToDoItem(IRepository<Project> repository)
+ {
+ _repository = repository;
+ }
+
+ [HttpPost(CreateToDoItemRequest.Route)]
+ [SwaggerOperation(
+ Summary = "Creates a new ToDo Item for a Project",
+ Description = "Creates a new ToDo Item for a Project",
+ OperationId = "Project.CreateToDoItem",
+ Tags = new[] { "ProjectEndpoints" })
+ ]
+ public override async Task<ActionResult> HandleAsync(
+ CreateToDoItemRequest request,
+ CancellationToken cancellationToken = new())
+ {
+ var spec = new ProjectByIdWithItemsSpec(request.ProjectId);
+ var entity = await _repository.FirstOrDefaultAsync(spec, cancellationToken);
+ if (entity == null)
+ {
+ return NotFound();
+ }
+
+ var newItem = new ToDoItem()
+ {
+ Title = request.Title!,
+ Description = request.Description!
+ };
+
+ if(request.ContributorId.HasValue)
+ {
+ newItem.AddContributor(request.ContributorId.Value);
+ }
+ entity.AddItem(newItem);
+ await _repository.UpdateAsync(entity);
+
+ return Created(GetProjectByIdRequest.BuildRoute(request.ProjectId), null);
+ }
+}
diff --git a/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/GetById.cs b/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/GetById.cs
index e681c1308..8a396d72b 100644
--- a/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/GetById.cs
+++ b/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/GetById.cs
@@ -40,7 +40,12 @@ public override async Task<ActionResult<GetProjectByIdResponse>> HandleAsync(
(
id: entity.Id,
name: entity.Name,
- items: entity.Items.Select(item => new ToDoItemRecord(item.Id, item.Title, item.Description, item.IsDone))
+ items: entity.Items.Select(
+ item => new ToDoItemRecord(item.Id,
+ item.Title,
+ item.Description,
+ item.IsDone,
+ item.ContributorId))
.ToList()
);
diff --git a/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/ListIncomplete.cs b/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/ListIncomplete.cs
index f061b203e..fdcefe195 100644
--- a/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/ListIncomplete.cs
+++ b/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/ListIncomplete.cs
@@ -43,7 +43,8 @@ public override async Task<ActionResult<ListIncompleteResponse>> HandleAsync(
item => new ToDoItemRecord(item.Id,
item.Title,
item.Description,
- item.IsDone)));
+ item.IsDone,
+ item.ContributorId)));
}
else if (result.Status == Ardalis.Result.ResultStatus.Invalid)
{
diff --git a/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/ToDoItemRecord.cs b/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/ToDoItemRecord.cs
index 694a76697..f351ebea9 100644
--- a/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/ToDoItemRecord.cs
+++ b/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/ToDoItemRecord.cs
@@ -1,3 +1,3 @@
ο»Ώnamespace Clean.Architecture.Web.Endpoints.ProjectEndpoints;
-public record ToDoItemRecord(int Id, string Title, string Description, bool IsDone);
+public record ToDoItemRecord(int Id, string Title, string Description, bool IsDone, int? ContributorId);
diff --git a/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/Update.cs b/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/Update.cs
index 9deab11de..f063dfd47 100644
--- a/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/Update.cs
+++ b/src/Clean.Architecture.Web/Endpoints/ProjectEndpoints/Update.cs
@@ -20,7 +20,7 @@ public Update(IRepository<Project> repository)
[HttpPut(UpdateProjectRequest.Route)]
[SwaggerOperation(
Summary = "Updates a Project",
- Description = "Updates a Project with a longer description",
+ Description = "Updates a Project. Only supports changing the name.",
OperationId = "Projects.Update",
Tags = new[] { "ProjectEndpoints" })
]
|
diff --git a/tests/Clean.Architecture.FunctionalTests/ApiEndpoints/ProjectCreate.cs b/tests/Clean.Architecture.FunctionalTests/ApiEndpoints/ProjectCreate.cs
new file mode 100644
index 000000000..e122bbfac
--- /dev/null
+++ b/tests/Clean.Architecture.FunctionalTests/ApiEndpoints/ProjectCreate.cs
@@ -0,0 +1,68 @@
+ο»Ώusing Ardalis.HttpClientTestExtensions;
+using Clean.Architecture.Web.Endpoints.ProjectEndpoints;
+using Xunit;
+using FluentAssertions;
+using Clean.Architecture.Web;
+
+namespace Clean.Architecture.FunctionalTests.ApiEndpoints;
+
+[Collection("Sequential")]
+public class ProjectCreate : IClassFixture<CustomWebApplicationFactory<Program>>
+{
+ private readonly HttpClient _client;
+
+ public ProjectCreate(CustomWebApplicationFactory<Program> factory)
+ {
+ _client = factory.CreateClient();
+ }
+
+ [Fact]
+ public async Task ReturnsOneProject()
+ {
+ string testName = Guid.NewGuid().ToString();
+ var request = new CreateProjectRequest() { Name = testName };
+ var content = StringContentHelpers.FromModelAsJson(request);
+
+ var result = await _client.PostAndDeserializeAsync<CreateProjectResponse>(
+ CreateProjectRequest.Route, content);
+
+ result.Name.Should().Be(testName);
+ result.Id.Should().BeGreaterThan(0);
+ }
+}
+
+[Collection("Sequential")]
+public class ProjectAddToDoItem : IClassFixture<CustomWebApplicationFactory<Program>>
+{
+ private readonly HttpClient _client;
+
+ public ProjectAddToDoItem(CustomWebApplicationFactory<Program> factory)
+ {
+ _client = factory.CreateClient();
+ }
+
+ [Fact]
+ public async Task AddsItemAndReturnsRouteToProject()
+ {
+ string toDoTitle = Guid.NewGuid().ToString();
+ int testProjectId = SeedData.TestProject1.Id;
+ var request = new CreateToDoItemRequest() {
+ Title = toDoTitle,
+ ProjectId = testProjectId,
+ Description = toDoTitle
+ };
+ var content = StringContentHelpers.FromModelAsJson(request);
+
+ var result = await _client.PostAsync(CreateToDoItemRequest.BuildRoute(testProjectId), content);
+
+ // useful for debugging error responses:
+ // var stringContent = await result.Content.ReadAsStringAsync();
+
+ string expectedRoute = GetProjectByIdRequest.BuildRoute(testProjectId);
+ result.Headers.Location!.ToString().Should().Be(expectedRoute);
+
+ var updatedProject = await _client.GetAndDeserializeAsync<GetProjectByIdResponse>(expectedRoute);
+
+ updatedProject.Items.Should().ContainSingle(item => item.Title == toDoTitle);
+ }
+}
diff --git a/tests/Clean.Architecture.FunctionalTests/ApiEndpoints/ProjectList.cs b/tests/Clean.Architecture.FunctionalTests/ApiEndpoints/ProjectList.cs
index 5064edb3e..9c1ea80d1 100644
--- a/tests/Clean.Architecture.FunctionalTests/ApiEndpoints/ProjectList.cs
+++ b/tests/Clean.Architecture.FunctionalTests/ApiEndpoints/ProjectList.cs
@@ -1,4 +1,5 @@
ο»Ώusing Ardalis.HttpClientTestExtensions;
+using Clean.Architecture.Core.ProjectAggregate;
using Clean.Architecture.Web;
using Clean.Architecture.Web.Endpoints.ProjectEndpoints;
using Xunit;
diff --git a/tests/Clean.Architecture.FunctionalTests/Clean.Architecture.FunctionalTests.csproj b/tests/Clean.Architecture.FunctionalTests/Clean.Architecture.FunctionalTests.csproj
index 5f25a3c7e..655190bf3 100644
--- a/tests/Clean.Architecture.FunctionalTests/Clean.Architecture.FunctionalTests.csproj
+++ b/tests/Clean.Architecture.FunctionalTests/Clean.Architecture.FunctionalTests.csproj
@@ -8,6 +8,7 @@
</PropertyGroup>
<ItemGroup>
+ <PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
|
Please show how you would create new ToDoItems
<!-- β οΈβ οΈ Do Not Delete This! feature_request_template β οΈβ οΈ -->
<!-- Please search existing issues to avoid creating duplicates. -->
<!-- Describe the feature you'd like. -->
In this template, you aggregate ToDoItems within the ProjectAggregate. However, you also stop short of showing how you would, via API, author new ToDoItem instances. I think it would be beneficial to show how you would create these new child items of a project.
I think it would be wonderful to see:
- How you would define this in an ApiEndpoint.
- How you would incorporate this within the ProjectAggregate.
- How you would codify a Many-to-Many relationship as opposed to the One-To-Many relationship between Project and ToDoItem.
- Is this implied by the Project <-> Contributor relationship?
- What if the Contributor to a Project had a title within that Project? Senior Contributor vs Junior Contributor? If that were the case what ApiEndpoint would the management of that be within your example domain?
Thanks for such a great template!
| null |
2023-04-09T15:39:56Z
|
0.1
|
['Clean.Architecture.FunctionalTests.ApiEndpoints.ProjectAddToDoItem.AddsItemAndReturnsRouteToProject', 'Clean.Architecture.FunctionalTests.ApiEndpoints.ProjectCreate.ReturnsOneProject']
|
[]
|
jellyfin/jellyfin
|
jellyfin__jellyfin-12621
|
987dbe98c8ab55c5c8eb563820e54453c835cdde
|
diff --git a/Emby.Naming/Video/VideoListResolver.cs b/Emby.Naming/Video/VideoListResolver.cs
index 51f29cf0887..12bc22a6ac0 100644
--- a/Emby.Naming/Video/VideoListResolver.cs
+++ b/Emby.Naming/Video/VideoListResolver.cs
@@ -141,7 +141,9 @@ private static List<VideoInfo> GetVideosGroupedByVersion(List<VideoInfo> videos,
{
if (group.Key)
{
- videos.InsertRange(0, group.OrderByDescending(x => x.Files[0].FileNameWithoutExtension.ToString(), new AlphanumericComparator()));
+ videos.InsertRange(0, group
+ .OrderByDescending(x => ResolutionRegex().Match(x.Files[0].FileNameWithoutExtension.ToString()).Value, new AlphanumericComparator())
+ .ThenBy(x => x.Files[0].FileNameWithoutExtension.ToString(), new AlphanumericComparator()));
}
else
{
|
diff --git a/tests/Jellyfin.Naming.Tests/Video/MultiVersionTests.cs b/tests/Jellyfin.Naming.Tests/Video/MultiVersionTests.cs
index 183ec898485..3005a4416c0 100644
--- a/tests/Jellyfin.Naming.Tests/Video/MultiVersionTests.cs
+++ b/tests/Jellyfin.Naming.Tests/Video/MultiVersionTests.cs
@@ -356,6 +356,45 @@ public void TestMultiVersion12()
Assert.Equal("/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - Theatrical Release.mkv", result[0].AlternateVersions[4].Path);
}
+ [Fact]
+ public void TestMultiVersion13()
+ {
+ var files = new[]
+ {
+ "/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - Theatrical Release.mkv",
+ "/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - Directors Cut.mkv",
+ "/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 1080p.mkv",
+ "/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 2160p.mkv",
+ "/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 1080p Directors Cut.mkv",
+ "/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 2160p Remux.mkv",
+ "/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 1080p Theatrical Release.mkv",
+ "/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 720p.mkv",
+ "/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 1080p Remux.mkv",
+ "/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 720p Directors Cut.mkv",
+ "/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 1080p High Bitrate.mkv",
+ "/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016).mkv",
+ };
+
+ var result = VideoListResolver.Resolve(
+ files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType<VideoFileInfo>().ToList(),
+ _namingOptions).ToList();
+
+ Assert.Single(result);
+ Assert.Equal("/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016).mkv", result[0].Files[0].Path);
+ Assert.Equal(11, result[0].AlternateVersions.Count);
+ Assert.Equal("/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 2160p.mkv", result[0].AlternateVersions[0].Path);
+ Assert.Equal("/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 2160p Remux.mkv", result[0].AlternateVersions[1].Path);
+ Assert.Equal("/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 1080p.mkv", result[0].AlternateVersions[2].Path);
+ Assert.Equal("/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 1080p Directors Cut.mkv", result[0].AlternateVersions[3].Path);
+ Assert.Equal("/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 1080p High Bitrate.mkv", result[0].AlternateVersions[4].Path);
+ Assert.Equal("/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 1080p Remux.mkv", result[0].AlternateVersions[5].Path);
+ Assert.Equal("/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 1080p Theatrical Release.mkv", result[0].AlternateVersions[6].Path);
+ Assert.Equal("/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 720p.mkv", result[0].AlternateVersions[7].Path);
+ Assert.Equal("/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - 720p Directors Cut.mkv", result[0].AlternateVersions[8].Path);
+ Assert.Equal("/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - Directors Cut.mkv", result[0].AlternateVersions[9].Path);
+ Assert.Equal("/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) - Theatrical Release.mkv", result[0].AlternateVersions[10].Path);
+ }
+
[Fact]
public void Resolve_GivenFolderNameWithBracketsAndHyphens_GroupsBasedOnFolderName()
{
|
Sort versions in ascending order when resolution is the same
Change movie version to sort in ascending order when resolution is the same
**Issues**
Fixes #12618
Versions are sorted in reverse alphabetical order when filename includes resolution
When multiple files share the same resolution in their filenames, they are sorted in reverse alphabetical order.
https://github.com/jellyfin/jellyfin/blob/54f663b0f3c4a9cc5a4f44d1afcb6e1de03c0503/Emby.Naming/Video/VideoListResolver.cs#L144

<br><br>
Since the resolutions are sorted based on the MediaInfo, it should be sufficient to change `OrderByDescending` to just `OrderBy` .
```c#
videos.InsertRange(0, group.OrderBy(x => x.Files[0].FileNameWithoutExtension.ToString(), new AlphanumericComparator()));
```
<br>
Making this change resolves the issue, and resolutions are sorted alphabetical, with higher resolutions listed first, regardless of whether the resolution is included in the filename.

Server: 10.9.11
|
Please provide the media info of all 3 files
Those were all the same file, just renamed. I'll also upload with different resolutions in a bit.
```
General
Unique ID : 34727860135091814094139690058492232674 (0x1A2057B2EBC11E00F924498B258D43E2)
Complete name : /media/max/testmedia/Multiple Versions/Big Buck Bunny (2008)/Big Buck Bunny (2008) - 2160p Director's cut.mkv
Format : Matroska
Format version : Version 4
File size : 604 MiB
Duration : 10 min 34 s
Overall bit rate : 7 980 kb/s
Frame rate : 30.000 FPS
Movie name : Big Buck Bunny, Sunflower version
Encoded date : 2024-06-23 14:51:05 UTC
Writing application : mkvmerge v85.0 ('Shame For You') 64-bit
Writing library : libebml v1.4.5 + libmatroska v1.7.1
Comment : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 10 min 34 s
Bit rate : 7 500 kb/s
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 30.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.030
Stream size : 567 MiB (94%)
Writing library : x264 core 120
```
Example with different resolution, current behavior:

<br><br>
With proposed changed in code:

<br>
Only two files tested here one 2160p media info above and 1080p info below. All versions are just copies.
```
General
Complete name : /media/max/testmedia/Multiple Versions/Big Buck Bunny (2008)/Big Buck Bunny (2008) - Alpha teneightyp.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/avc1)
File size : 263 MiB
Duration : 10 min 34 s
Overall bit rate : 3 481 kb/s
Frame rate : 30.000 FPS
Movie name : Big Buck Bunny, Sunflower version
Performer : Blender Foundation 2008, Janus Bager Kristensen 2013
Composer : Sacha Goedegebure
Genre : Animation
Encoded date : 2013-12-16 17:44:39 UTC
Tagged date : 2013-12-16 17:44:39 UTC
Comment : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
com : Jan Morgenstern
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 4 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 10 min 34 s
Bit rate : 3 000 kb/s
Maximum bit rate : 16.7 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 30.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.048
Stream size : 227 MiB (86%)
Writing library : x264 core 115
```
|
2024-09-09T20:27:19Z
|
0.1
|
['Jellyfin.Naming.Tests.Video.MultiVersionTests.TestMultiVersion13']
|
['Jellyfin.Naming.Tests.Video.MultiVersionTests.TestMultiVersion4', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.TestMultiVersion10', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.TestMultiVersion11', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.TestMultiVersion5', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.Resolve_GivenFolderNameWithBracketsAndHyphens_GroupsBasedOnFolderName', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.TestMultiVersion9', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.TestLetterFolders', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.TestMultiVersion6', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.TestEmptyList', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.TestMultiVersionLimit2', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.TestMultiEdition2', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.TestMultiVersion12', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.TestMultiVersion8', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.TestMultiEdition1', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.TestMultiVersion7', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.TestMultiVersionLimit', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.TestMultiEdition3', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.TestMultiVersion3', 'Jellyfin.Naming.Tests.Video.MultiVersionTests.Resolve_GivenUnclosedBrackets_DoesNotGroup']
|
jellyfin/jellyfin
|
jellyfin__jellyfin-12558
|
2fe13f54eaf87eefefd27f4ccb2ace1371f5e886
|
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 8bd4fb4f382..f16558d1e7c 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -1180,28 +1180,29 @@ private MediaSourceInfo GetVersionInfo(bool enablePathSubstitution, BaseItem ite
return info;
}
- private string GetMediaSourceName(BaseItem item)
+ internal string GetMediaSourceName(BaseItem item)
{
var terms = new List<string>();
var path = item.Path;
if (item.IsFileProtocol && !string.IsNullOrEmpty(path))
{
+ var displayName = System.IO.Path.GetFileNameWithoutExtension(path);
if (HasLocalAlternateVersions)
{
- var displayName = System.IO.Path.GetFileNameWithoutExtension(path)
- .Replace(System.IO.Path.GetFileName(ContainingFolderPath), string.Empty, StringComparison.OrdinalIgnoreCase)
- .TrimStart(new char[] { ' ', '-' });
-
- if (!string.IsNullOrEmpty(displayName))
+ var containingFolderName = System.IO.Path.GetFileName(ContainingFolderPath);
+ if (displayName.Length > containingFolderName.Length && displayName.StartsWith(containingFolderName, StringComparison.OrdinalIgnoreCase))
{
- terms.Add(displayName);
+ var name = displayName.AsSpan(containingFolderName.Length).TrimStart([' ', '-']);
+ if (!name.IsWhiteSpace())
+ {
+ terms.Add(name.ToString());
+ }
}
}
if (terms.Count == 0)
{
- var displayName = System.IO.Path.GetFileNameWithoutExtension(path);
terms.Add(displayName);
}
}
|
diff --git a/tests/Jellyfin.Controller.Tests/Entities/BaseItemTests.cs b/tests/Jellyfin.Controller.Tests/Entities/BaseItemTests.cs
index f3ada59dbcd..6171f12e472 100644
--- a/tests/Jellyfin.Controller.Tests/Entities/BaseItemTests.cs
+++ b/tests/Jellyfin.Controller.Tests/Entities/BaseItemTests.cs
@@ -1,4 +1,7 @@
using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Library;
+using MediaBrowser.Model.MediaInfo;
+using Moq;
using Xunit;
namespace Jellyfin.Controller.Tests.Entities;
@@ -14,4 +17,30 @@ public class BaseItemTests
[InlineData("1test 2", "0000000001test 0000000002")]
public void BaseItem_ModifySortChunks_Valid(string input, string expected)
=> Assert.Equal(expected, BaseItem.ModifySortChunks(input));
+
+ [Theory]
+ [InlineData("/Movies/Ted/Ted.mp4", "/Movies/Ted/Ted - Unrated Edition.mp4", "Ted", "Unrated Edition")]
+ [InlineData("/Movies/Deadpool 2 (2018)/Deadpool 2 (2018).mkv", "/Movies/Deadpool 2 (2018)/Deadpool 2 (2018) - Super Duper Cut.mkv", "Deadpool 2 (2018)", "Super Duper Cut")]
+ public void GetMediaSourceName_Valid(string primaryPath, string altPath, string name, string altName)
+ {
+ var mediaSourceManager = new Mock<IMediaSourceManager>();
+ mediaSourceManager.Setup(x => x.GetPathProtocol(It.IsAny<string>()))
+ .Returns((string x) => MediaProtocol.File);
+ BaseItem.MediaSourceManager = mediaSourceManager.Object;
+
+ var video = new Video()
+ {
+ Path = primaryPath
+ };
+
+ var videoAlt = new Video()
+ {
+ Path = altPath,
+ };
+
+ video.LocalAlternateVersions = [videoAlt.Path];
+
+ Assert.Equal(name, video.GetMediaSourceName(video));
+ Assert.Equal(altName, video.GetMediaSourceName(videoAlt));
+ }
}
|
Movie Version Name Changes Based on Title of Movie
### This issue respects the following points:
- [X] This is a **bug**, not a question or a configuration issue; Please visit our forum or chat rooms first to troubleshoot with volunteers, before creating a report. The links can be found [here](https://jellyfin.org/contact/).
- [X] This issue is **not** already reported on [GitHub](https://github.com/jellyfin/jellyfin/issues?q=is%3Aopen+is%3Aissue) _(I've searched it)_.
- [X] I'm using an up to date version of Jellyfin Server stable, unstable or master; We generally do not support previous older versions. If possible, please update to the latest version before opening an issue.
- [X] I agree to follow Jellyfin's [Code of Conduct](https://jellyfin.org/docs/general/community-standards.html#code-of-conduct).
- [X] This report addresses only a single issue; If you encounter multiple issues, kindly create separate reports for each one.
### Description of the bug
When a movie has multiple versions available, version names will be modified in a way where if the title of the movie appears in the version name, the title will be removed. This causes issues with certain version names.
### Reproduction steps
1. Prepare two video files, name one "[movie_name] - [version 1]" and the other "[movie_name] - [version 2]"
2. Create a folder in your movies folder named "[movie_name]"
3. Move the two video files to the newly created folder
### What is the current _bug_ behavior?
If [movie_name] appears anywhere within the text of [version 1] and/or [version 2], then [movie_name] will be removed from the version name.
Hypothetical Example: file names "Rap - 1. Holy crap dude!"; "Rap - 2. Wrapping paper" results in version names display on Jellyfin "1. Holy c dude!"; "2. Wping paper"
Real Example: file names "Ted - 1. Theatrical Version"; "Ted - 2. Unrated Version" results in version names display on Jellyfin "1. Theatrical Version"; "2. Unra Version"
### What is the expected _correct_ behavior?
If [movie_name] appears anywhere within the text of [version 1] and/or [version 2], the version name does not change.
Hypothetical Example: file names "Rap - 1. Holy crap dude!"; "Rap - 2. Wrapping paper" results in version names display on Jellyfin "1. Holy crap dude!"; "2. Wrapping paper"
Real Example: file names "Ted - 1. Theatrical Version"; "Ted - 2. Unrated Version" results in version names display on Jellyfin "1. Theatrical Version"; "2. Unrated Version"
### Jellyfin Server version
Older*
### Specify commit id
_No response_
### Specify unstable release number
_No response_
### Specify version number
10.9.7
### Specify the build version
Release
### Environment
```markdown
- OS: Windows 10
- Linux Kernel: none
- Virtualization: Docker? (using package for Synology available on synocommunity.com)
- Clients: Browser, Windows, Mac OS, Android, iPhone
- Browser: Chrome 127.0.6533.88
- FFmpeg Version: 6.0.1
- Playback Method: N/A
- Hardware Acceleration: none
- GPU Model: N/A
- Plugins: none
- Reverse Proxy: none
- Base URL: none
- Networking: Host
- Storage: local & remote NAS
```
### Jellyfin logs
```shell
N/A
```
### FFmpeg logs
_No response_
### Client / Browser logs
_No response_
### Relevant screenshots or videos


### Additional information
_No response_
| null |
2024-08-31T12:02:58Z
|
0.1
|
['Jellyfin.Controller.Tests.Entities.BaseItemTests.GetMediaSourceName_Valid']
|
['Jellyfin.Controller.Tests.Entities.BaseItemTests.BaseItem_ModifySortChunks_Valid']
|
jellyfin/jellyfin
|
jellyfin__jellyfin-12550
|
2fe13f54eaf87eefefd27f4ccb2ace1371f5e886
|
diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs
index 37e24141429..76bc4f49d83 100644
--- a/MediaBrowser.Controller/Entities/TV/Episode.cs
+++ b/MediaBrowser.Controller/Entities/TV/Episode.cs
@@ -180,10 +180,7 @@ public override List<string> GetUserDataKeys()
}
public string FindSeriesPresentationUniqueKey()
- {
- var series = Series;
- return series is null ? null : series.PresentationUniqueKey;
- }
+ => Series?.PresentationUniqueKey;
public string FindSeasonName()
{
diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
index 4af000557e6..120cb2b2dd5 100644
--- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs
+++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
@@ -430,8 +430,6 @@ public static QueryResult<BaseItem> PostFilterAndSort(
InternalItemsQuery query,
ILibraryManager libraryManager)
{
- var user = query.User;
-
// This must be the last filter
if (!query.AdjacentTo.IsNullOrEmpty())
{
diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
index 788ecbae2d0..cd0efa774f1 100644
--- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
@@ -1207,7 +1207,8 @@ public void GenerateConcatConfig(MediaSourceInfo source, string concatFilePath)
}
// Generate concat configuration entries for each file and write to file
- using StreamWriter sw = new StreamWriter(concatFilePath);
+ Directory.CreateDirectory(Path.GetDirectoryName(concatFilePath));
+ using StreamWriter sw = new FormattingStreamWriter(concatFilePath, CultureInfo.InvariantCulture);
foreach (var path in files)
{
var mediaInfoResult = GetMediaInfo(
diff --git a/src/Jellyfin.Extensions/FormattingStreamWriter.cs b/src/Jellyfin.Extensions/FormattingStreamWriter.cs
new file mode 100644
index 00000000000..40e3c5a68f6
--- /dev/null
+++ b/src/Jellyfin.Extensions/FormattingStreamWriter.cs
@@ -0,0 +1,38 @@
+using System;
+using System.IO;
+
+namespace Jellyfin.Extensions;
+
+/// <summary>
+/// A custom StreamWriter which supports setting a IFormatProvider.
+/// </summary>
+public class FormattingStreamWriter : StreamWriter
+{
+ private readonly IFormatProvider _formatProvider;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="FormattingStreamWriter"/> class.
+ /// </summary>
+ /// <param name="stream">The stream to write to.</param>
+ /// <param name="formatProvider">The format provider to use.</param>
+ public FormattingStreamWriter(Stream stream, IFormatProvider formatProvider)
+ : base(stream)
+ {
+ _formatProvider = formatProvider;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="FormattingStreamWriter"/> class.
+ /// </summary>
+ /// <param name="path">The complete file path to write to.</param>
+ /// <param name="formatProvider">The format provider to use.</param>
+ public FormattingStreamWriter(string path, IFormatProvider formatProvider)
+ : base(path)
+ {
+ _formatProvider = formatProvider;
+ }
+
+ /// <inheritdoc />
+ public override IFormatProvider FormatProvider
+ => _formatProvider;
+}
|
diff --git a/tests/Jellyfin.Extensions.Tests/FormattingStreamWriterTests.cs b/tests/Jellyfin.Extensions.Tests/FormattingStreamWriterTests.cs
new file mode 100644
index 00000000000..06e3c272130
--- /dev/null
+++ b/tests/Jellyfin.Extensions.Tests/FormattingStreamWriterTests.cs
@@ -0,0 +1,23 @@
+using System.Globalization;
+using System.IO;
+using System.Text;
+using System.Threading;
+using Xunit;
+
+namespace Jellyfin.Extensions.Tests;
+
+public static class FormattingStreamWriterTests
+{
+ [Fact]
+ public static void Shuffle_Valid_Correct()
+ {
+ Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE", false);
+ using (var ms = new MemoryStream())
+ using (var txt = new FormattingStreamWriter(ms, CultureInfo.InvariantCulture))
+ {
+ txt.Write("{0}", 3.14159);
+ txt.Close();
+ Assert.Equal("3.14159", Encoding.UTF8.GetString(ms.ToArray()));
+ }
+ }
+}
|
Error processing request. FfmpegException
### This issue respects the following points:
- [X] This is a **bug**, not a question or a configuration issue; Please visit our forum or chat rooms first to troubleshoot with volunteers, before creating a report. The links can be found [here](https://jellyfin.org/contact/).
- [X] This issue is **not** already reported on [GitHub](https://github.com/jellyfin/jellyfin/issues?q=is%3Aopen+is%3Aissue) _(I've searched it)_.
- [X] I'm using an up to date version of Jellyfin Server stable, unstable or master; We generally do not support previous older versions. If possible, please update to the latest version before opening an issue.
- [X] I agree to follow Jellyfin's [Code of Conduct](https://jellyfin.org/docs/general/community-standards.html#code-of-conduct).
- [X] This report addresses only a single issue; If you encounter multiple issues, kindly create separate reports for each one.
### Description of the bug
Nach dem Update auf 10.9.9 bekomme ich beim Abspielen von MKV Dateien folgende Fehler.
Egal ob ich mit oder ohne Hartwardecoder Arbeite.
Neu Installation Deinstallation mit Neuinstallation. Neuanlage der Bibliothek hat nicht geholfen.
Ich habe hier schon ΓΌber alle gesucht auch Γ€hnliche Fehler gefunden nur nicht fΓΌr Windows System.
Dem entsprechend bin ich ΓΌberfragt was ich tun kann.
Entschuldigt mein Schlechtes Englisch.
Danke schon mal fΓΌr die Hilfe.
After updating to 10.9.9 I get the following errors when playing MKV files.
Regardless of whether I work with or without a hardware decoder.
Reinstallation Uninstallation with reinstallation. Reinstalling the library did not help.
I have already searched for similar errors here, but not for Windows systems.
So I am not sure what I can do.
Sorry for my bad English.
Thanks for the help.
### Reproduction steps
Play a MKV Titele
### What is the current _bug_ behavior?
Title is not playing
### What is the expected _correct_ behavior?
Play the Title
### Jellyfin Server version
10.9.9+
### Specify commit id
_No response_
### Specify unstable release number
_No response_
### Specify version number
_No response_
### Specify the build version
10.9.9
### Environment
```markdown
Intel i5-4800k
Nvidia 1080Ti
32GB-Ram
SSD 1tb
Windows 10.
Clients Firefox Android, Firestick Chrome
6.0.1-Jellyfin
```
### Jellyfin logs
```shell
[2024-08-12 11:07:44.381 +02:00] [ERR] [66] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request. URL "GET" "/videos/6ba68b9e-5575-aea5-03fa-95d37f39e021/hls1/main/-1.mp4".
MediaBrowser.Common.FfmpegException: FFmpeg exited with code 1
at MediaBrowser.MediaEncoding.Transcoding.TranscodeManager.StartFfMpeg(StreamState state, String outputPath, String commandLineArguments, Guid userId, TranscodingJobType transcodingJobType, CancellationTokenSource cancellationTokenSource, String workingDirectory)
at Jellyfin.Api.Controllers.DynamicHlsController.GetDynamicSegment(StreamingRequestDto streamingRequest, Int32 segmentId)
at Jellyfin.Api.Controllers.DynamicHlsController.GetHlsVideoSegment(Guid itemId, String playlistId, Int32 segmentId, String container, Int64 runtimeTicks, Int64 actualSegmentLengthTicks, Nullable`1 static, String params, String tag, String deviceProfileId, String playSessionId, String segmentContainer, Nullable`1 segmentLength, Nullable`1 minSegments, String mediaSourceId, String deviceId, String audioCodec, Nullable`1 enableAutoStreamCopy, Nullable`1 allowVideoStreamCopy, Nullable`1 allowAudioStreamCopy, Nullable`1 breakOnNonKeyFrames, Nullable`1 audioSampleRate, Nullable`1 maxAudioBitDepth, Nullable`1 audioBitRate, Nullable`1 audioChannels, Nullable`1 maxAudioChannels, String profile, String level, Nullable`1 framerate, Nullable`1 maxFramerate, Nullable`1 copyTimestamps, Nullable`1 startTimeTicks, Nullable`1 width, Nullable`1 height, Nullable`1 maxWidth, Nullable`1 maxHeight, Nullable`1 videoBitRate, Nullable`1 subtitleStreamIndex, Nullable`1 subtitleMethod, Nullable`1 maxRefFrames, Nullable`1 maxVideoBitDepth, Nullable`1 requireAvc, Nullable`1 deInterlace, Nullable`1 requireNonAnamorphic, Nullable`1 transcodingMaxAudioChannels, Nullable`1 cpuCoreLimit, String liveStreamId, Nullable`1 enableMpegtsM2TsMode, String videoCodec, String subtitleCodec, String transcodeReasons, Nullable`1 audioStreamIndex, Nullable`1 videoStreamIndex, Nullable`1 context, Dictionary`2 streamOptions)
at lambda_method1218(Closure, Object)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Jellyfin.Api.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
at Jellyfin.Api.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
at Jellyfin.Api.Middleware.IPBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
at Jellyfin.Api.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Jellyfin.Api.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Jellyfin.Api.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
at Jellyfin.Api.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
at Jellyfin.Api.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)
at Jellyfin.Api.Middleware.ExceptionMiddleware.Invoke(HttpContext context)
```
### FFmpeg logs
```shell
{"Protocol":0,"Id":"6ba68b9e5575aea503fa95d37f39e021","Path":"I:\\Pittis Blue Ray Filmarchiv\\The 6th Day","EncoderPath":null,"EncoderProtocol":null,"Type":0,"Container":"ts","Size":3999946752,"Name":"The 6th Day/Bluray","IsRemote":false,"ETag":"543b6ca4c9f21c87d81daf7a932499c0","RunTimeTicks":74144069333,"ReadAtNativeFramerate":false,"IgnoreDts":false,"IgnoreIndex":false,"GenPtsInput":false,"SupportsTranscoding":true,"SupportsDirectStream":false,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"OpenToken":null,"RequiresClosing":false,"LiveStreamId":null,"BufferMs":null,"RequiresLooping":false,"SupportsProbing":true,"VideoType":3,"IsoType":null,"Video3DFormat":null,"MediaStreams":[{"Codec":"h264","CodecTag":null,"Language":null,"ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":null,"CodecTimeBase":null,"Title":null,"VideoRange":1,"VideoRangeType":1,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"LocalizedHearingImpaired":null,"DisplayTitle":"1080p H264 SDR","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":null,"BitRate":9061327,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Height":1080,"Width":1920,"AverageFrameRate":23.976025,"RealFrameRate":23.976025,"Profile":null,"Type":1,"AspectRatio":null,"Index":0,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":null,"Level":null,"IsAnamorphic":null},{"Codec":"AC3","CodecTag":null,"Language":"ger","ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":null,"CodecTimeBase":null,"Title":null,"VideoRange":0,"VideoRangeType":0,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":null,"LocalizedDefault":"Standard","LocalizedForced":null,"LocalizedExternal":"Extern","LocalizedHearingImpaired":null,"DisplayTitle":"Ger - Dolby Digital - 6 ch","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":null,"BitRate":448000,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":6,"SampleRate":48000,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":0,"AspectRatio":null,"Index":1,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":null,"Level":null,"IsAnamorphic":null},{"Codec":"AC3","CodecTag":null,"Language":"eng","ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":null,"CodecTimeBase":null,"Title":null,"VideoRange":0,"VideoRangeType":0,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":null,"LocalizedDefault":"Standard","LocalizedForced":null,"LocalizedExternal":"Extern","LocalizedHearingImpaired":null,"DisplayTitle":"Englisch - Dolby Digital - 6 ch","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":null,"BitRate":448000,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":6,"SampleRate":48000,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":0,"AspectRatio":null,"Index":2,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":null,"Level":null,"IsAnamorphic":null},{"Codec":"AC3","CodecTag":null,"Language":"rus","ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":null,"CodecTimeBase":null,"Title":null,"VideoRange":0,"VideoRangeType":0,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":null,"LocalizedDefault":"Standard","LocalizedForced":null,"LocalizedExternal":"Extern","LocalizedHearingImpaired":null,"DisplayTitle":"Russisch - Dolby Digital - 6 ch","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":null,"BitRate":448000,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":6,"SampleRate":48000,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":0,"AspectRatio":null,"Index":3,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":null,"Level":null,"IsAnamorphic":null},{"Codec":"TrueHD","CodecTag":null,"Language":"ger","ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":null,"CodecTimeBase":null,"Title":null,"VideoRange":0,"VideoRangeType":0,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":null,"LocalizedDefault":"Standard","LocalizedForced":null,"LocalizedExternal":"Extern","LocalizedHearingImpaired":null,"DisplayTitle":"Ger - TRUEHD - 6 ch","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":null,"BitRate":null,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":6,"SampleRate":48000,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":0,"AspectRatio":null,"Index":4,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":null,"Level":null,"IsAnamorphic":null},{"Codec":"PGS","CodecTag":null,"Language":"ger","ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":null,"CodecTimeBase":null,"Title":null,"VideoRange":0,"VideoRangeType":0,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":"Undefiniert","LocalizedDefault":"Standard","LocalizedForced":"Erzwungen","LocalizedExternal":"Extern","LocalizedHearingImpaired":"H\u00F6rgesch\u00E4digt","DisplayTitle":"Ger - PGS","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":null,"BitRate":null,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":2,"AspectRatio":null,"Index":5,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":null,"Level":null,"IsAnamorphic":null},{"Codec":"PGS","CodecTag":null,"Language":"eng","ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":null,"CodecTimeBase":null,"Title":null,"VideoRange":0,"VideoRangeType":0,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":"Undefiniert","LocalizedDefault":"Standard","LocalizedForced":"Erzwungen","LocalizedExternal":"Extern","LocalizedHearingImpaired":"H\u00F6rgesch\u00E4digt","DisplayTitle":"Englisch - PGS","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":null,"BitRate":null,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":2,"AspectRatio":null,"Index":6,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":null,"Level":null,"IsAnamorphic":null},{"Codec":"PGS","CodecTag":null,"Language":"rus","ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":null,"CodecTimeBase":null,"Title":null,"VideoRange":0,"VideoRangeType":0,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":"Undefiniert","LocalizedDefault":"Standard","LocalizedForced":"Erzwungen","LocalizedExternal":"Extern","LocalizedHearingImpaired":"H\u00F6rgesch\u00E4digt","DisplayTitle":"Russisch - PGS","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":null,"BitRate":null,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":2,"AspectRatio":null,"Index":7,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":null,"Level":null,"IsAnamorphic":null}],"MediaAttachments":[],"Formats":[],"Bitrate":11045327,"Timestamp":2,"RequiredHttpHeaders":{},"TranscodingUrl":null,"TranscodingSubProtocol":0,"TranscodingContainer":null,"AnalyzeDurationMs":null,"DefaultAudioStreamIndex":null,"DefaultSubtitleStreamIndex":null}
ffmpeg -analyzeduration 200M -probesize 1G -f concat -safe 0 -i "C:\ProgramData\Jellyfin\Server\cache\transcodes\6ba68b9e5575aea503fa95d37f39e021.concat" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 libx264 -preset medium -crf 23 -maxrate 9061327 -bufsize 18122654 -profile:v:0 high -level 51 -x264opts:0 subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none -force_key_frames:0 "expr:gte(t,n_forced*3)" -sc_threshold:v:0 0 -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale=trunc(min(max(iw\,ih*a)\,min(1920\,1080*a))/2)*2:trunc(min(max(iw/a\,ih)\,min(1920/a\,1080))/2)*2,format=yuv420p" -codec:a:0 libfdk_aac -ac 2 -ab 256000 -af "volume=2" -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type fmp4 -hls_fmp4_init_filename "C:\ProgramData\Jellyfin\Server\cache\transcodes\f9c9739596bf17dfcf2da4cbb365bddb-1.mp4" -start_number 0 -hls_segment_filename "C:\ProgramData\Jellyfin\Server\cache\transcodes\f9c9739596bf17dfcf2da4cbb365bddb%d.mp4" -hls_playlist_type vod -hls_list_size 0 -y "C:\ProgramData\Jellyfin\Server\cache\transcodes\f9c9739596bf17dfcf2da4cbb365bddb.m3u8"
ffmpeg version 6.0.1-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 13-win32 (GCC)
configuration: --prefix=/opt/ffmpeg --arch=x86_64 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --pkg-config=pkg-config --pkg-config-flags=--static --extra-version=Jellyfin --disable-ffplay --disable-debug --disable-doc --disable-sdl2 --disable-ptx-compression --disable-w32threads --enable-pthreads --enable-shared --enable-lto --enable-gpl --enable-version3 --enable-schannel --enable-iconv --enable-libxml2 --enable-zlib --enable-lzma --enable-gmp --enable-chromaprint --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libwebp --enable-libvpx --enable-libzimg --enable-libx264 --enable-libx265 --enable-libsvtav1 --enable-libdav1d --enable-libfdk-aac --enable-opencl --enable-dxva2 --enable-d3d11va --enable-amf --enable-libvpl --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
libavutil 58. 2.100 / 58. 2.100
libavcodec 60. 3.100 / 60. 3.100
libavformat 60. 3.100 / 60. 3.100
libavdevice 60. 1.100 / 60. 1.100
libavfilter 9. 3.100 / 9. 3.100
libswscale 7. 1.100 / 7. 1.100
libswresample 4. 10.100 / 4. 10.100
libpostproc 57. 1.100 / 57. 1.100
[concat @ 00000230306ea140] Line 2: invalid duration '3531,444544'
C:\ProgramData\Jellyfin\Server\cache\transcodes\6ba68b9e5575aea503fa95d37f39e021.concat: Invalid argument
```
### Client / Browser logs
_No response_
### Relevant screenshots or videos
_No response_
### Additional information
_No response_
|
So the tdlr is the concat file writes the duration float wrong due to internationalization.
Down there is the detailed issue description + fix:
### Please describe your bug
All DVD structured folders aka VIDEO_TS aren't played because ffmpeg exits before.
This is because of wrong generated concat files in C:\Users\XXX\AppData\Local\jellyfin\cache\transcodes.
**example content of such a concat file before it gets deleted:**
> file 'C:\Movies\WHOAMI\VIDEO_TS\VTS_01_1.VOB'
> duration 925,696
> file 'C:\Movies\WHOAMI\VIDEO_TS\VTS_01_2.VOB'
> duration 881,056
> file 'C:\Movies\WHOAMI\VIDEO_TS\VTS_01_3.VOB'
> duration 924,64
> file 'C:\Movies\WHOAMI\VIDEO_TS\VTS_01_4.VOB'
> duration 855,168
> file 'C:\Movies\WHOAMI\VIDEO_TS\VTS_01_5.VOB'
> duration 879,2
> file 'C:\Movies\WHOAMI\VIDEO_TS\VTS_01_6.VOB'
> duration 966,56
**1. Problem:**
as one can see the duraction is represented in numbers using a comma which ffmpeg can't use because of the wrong formatting.
if i turn all the commas into dots and save the file afterwards the ffmpeg command works.
I think my generated concat file uses commas because in germany these floats are represented with commas and not with dots like in the us.
**EDIT (this should be the fix in the sourcecode):**
Seems like the issue is in the `MediEncoder.cs` File at public void `GenerateConcatConfig(MediaSourceInfo source, string concatFilePath)`
The line `var duration = TimeSpan.FromTicks(mediaInfoResult.RunTimeTicks.Value).TotalSeconds;` doesn't format the TimeSpan properly so other internationalizations don't represent the TimeSpan diffrently.
**So the fixed code would be:**
`
sw.WriteLine("duration {0}", duration.ToString(new System.Globalization.NumberFormatInfo
{
NumberDecimalSeparator = "."
}));
EDIT2 : just delete the duration line entirely?
`
---pls fix this for me its my second time using github and im to dumb to pull---
**2. Problem:**
the concat file doesn't include the last vob file every time.
**The video folder has the follwoing files inside (using the dir command):**
> 04.05.2015 21:34 12.288 VIDEO_TS.BUP
> 04.05.2015 21:34 12.288 VIDEO_TS.IFO
> 03.06.2024 12:50 8.370 VIDEO_TS.nfo
> 04.05.2015 21:34 67.584 VTS_01_0.BUP
> 04.05.2015 21:34 67.584 VTS_01_0.IFO
> 04.05.2015 21:34 1.073.256.448 VTS_01_1.VOB
> 04.05.2015 21:34 1.073.195.008 VTS_01_2.VOB
> 04.05.2015 21:34 1.073.276.928 VTS_01_3.VOB
> 04.05.2015 21:34 1.073.356.800 VTS_01_4.VOB
> 04.05.2015 21:34 1.073.539.072 VTS_01_5.VOB
> 04.05.2015 21:34 1.073.453.056 VTS_01_6.VOB
> 04.05.2015 21:34 807.540.736 VTS_01_7.VOB
so the last few minutes of the film are missing. If i add another line after the last one of the concat file with _file 'C:\Movies\WHOAMI\VIDEO_TS\VTS_01_7.VOB'_ the whole movie is displayed.
### Reproduction Steps
1. Install Windows in German
2. Install Jellyfin Windows via Installer in German too
3. Include Media which has the DVD structure (VIDEO_TS)
4. Play that Media and get an error
5. Check the temporary concat file which gets created
### Jellyfin Version
10.9.0
### if other:
10.9.4
### Environment
```markdown
- OS: Windows10
- Linux Kernel:-
- Virtualization:-
- Clients:-
- Browser:Firefox (latest)
- FFmpeg Version:ffmpeg version 6.0.1-Jellyfin
- Playback Method:Browser
- Hardware Acceleration: tested with software and intel quick sync. Not hw acc related.
- GPU Model:-
- Plugins:-
- Reverse Proxy:-
- Base URL:localhost
- Networking:-
- Storage: local C drive
```
### Jellyfin logs
```shell
[2024-06-03 20:40:09.779 +02:00] [ERR] [55] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request. URL "GET" "/videos/4d32af64-eb44-4677-6a7e-2df132b2e4a7/hls1/main/0.ts".
MediaBrowser.Common.FfmpegException: FFmpeg exited with code 1
at MediaBrowser.MediaEncoding.Transcoding.TranscodeManager.StartFfMpeg(StreamState state, String outputPath, String commandLineArguments, Guid userId, TranscodingJobType transcodingJobType, CancellationTokenSource cancellationTokenSource, String workingDirectory)
at Jellyfin.Api.Controllers.DynamicHlsController.GetDynamicSegment(StreamingRequestDto streamingRequest, Int32 segmentId)
at Jellyfin.Api.Controllers.DynamicHlsController.GetHlsVideoSegment(Guid itemId, String playlistId, Int32 segmentId, String container, Int64 runtimeTicks, Int64 actualSegmentLengthTicks, Nullable`1 static, String params, String tag, String deviceProfileId, String playSessionId, String segmentContainer, Nullable`1 segmentLength, Nullable`1 minSegments, String mediaSourceId, String deviceId, String audioCodec, Nullable`1 enableAutoStreamCopy, Nullable`1 allowVideoStreamCopy, Nullable`1 allowAudioStreamCopy, Nullable`1 breakOnNonKeyFrames, Nullable`1 audioSampleRate, Nullable`1 maxAudioBitDepth, Nullable`1 audioBitRate, Nullable`1 audioChannels, Nullable`1 maxAudioChannels, String profile, String level, Nullable`1 framerate, Nullable`1 maxFramerate, Nullable`1 copyTimestamps, Nullable`1 startTimeTicks, Nullable`1 width, Nullable`1 height, Nullable`1 maxWidth, Nullable`1 maxHeight, Nullable`1 videoBitRate, Nullable`1 subtitleStreamIndex, Nullable`1 subtitleMethod, Nullable`1 maxRefFrames, Nullable`1 maxVideoBitDepth, Nullable`1 requireAvc, Nullable`1 deInterlace, Nullable`1 requireNonAnamorphic, Nullable`1 transcodingMaxAudioChannels, Nullable`1 cpuCoreLimit, String liveStreamId, Nullable`1 enableMpegtsM2TsMode, String videoCodec, String subtitleCodec, String transcodeReasons, Nullable`1 audioStreamIndex, Nullable`1 videoStreamIndex, Nullable`1 context, Dictionary`2 streamOptions)
at lambda_method1078(Closure, Object)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|7_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Jellyfin.Api.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
at Jellyfin.Api.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
at Jellyfin.Api.Middleware.IPBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
at Jellyfin.Api.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Jellyfin.Api.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Jellyfin.Api.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
at Jellyfin.Api.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
at Jellyfin.Api.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)
at Jellyfin.Api.Middleware.ExceptionMiddleware.Invoke(HttpContext context)
```
### FFmpeg logs
```shell
{"Protocol":0,"Id":"4d32af64eb4446776a7e2df132b2e4a7","Path":"C:\\Movies\\WHOAMI","EncoderPath":null,"EncoderProtocol":null,"Type":0,"Container":"ts","Size":1073256448,"Name":"WHOAMI/DVD","IsRemote":false,"ETag":"543b6ca4c9f21c87d81daf7a932499c0","RunTimeTicks":54323200000,"ReadAtNativeFramerate":false,"IgnoreDts":false,"IgnoreIndex":false,"GenPtsInput":false,"SupportsTranscoding":true,"SupportsDirectStream":false,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"OpenToken":null,"RequiresClosing":false,"LiveStreamId":null,"BufferMs":null,"RequiresLooping":false,"SupportsProbing":true,"VideoType":2,"IsoType":null,"Video3DFormat":null,"MediaStreams":[{"Codec":"dvd_nav_packet","CodecTag":null,"Language":null,"ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":"1/90000","CodecTimeBase":null,"Title":null,"VideoRange":0,"VideoRangeType":0,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"LocalizedHearingImpaired":null,"DisplayTitle":null,"NalLengthSize":null,"IsInterlaced":false,"IsAVC":false,"ChannelLayout":null,"BitRate":null,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":4,"AspectRatio":null,"Index":0,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":null,"Level":0,"IsAnamorphic":null},{"Codec":"mpeg2video","CodecTag":null,"Language":null,"ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":"1/90000","CodecTimeBase":null,"Title":null,"VideoRange":1,"VideoRangeType":1,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"LocalizedHearingImpaired":null,"DisplayTitle":"480p MPEG2VIDEO SDR","NalLengthSize":null,"IsInterlaced":false,"IsAVC":false,"ChannelLayout":null,"BitRate":9275238,"BitDepth":8,"RefFrames":1,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Height":480,"Width":720,"AverageFrameRate":25,"RealFrameRate":25,"Profile":"Main","Type":1,"AspectRatio":"16:9","Index":1,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":"yuv420p","Level":8,"IsAnamorphic":false},{"Codec":"ac3","CodecTag":null,"Language":null,"ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":"1/90000","CodecTimeBase":null,"Title":null,"VideoRange":0,"VideoRangeType":0,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"LocalizedHearingImpaired":null,"DisplayTitle":"Dolby Digital - 5.1","NalLengthSize":null,"IsInterlaced":false,"IsAVC":false,"ChannelLayout":"5.1","BitRate":448000,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":6,"SampleRate":48000,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":0,"AspectRatio":null,"Index":2,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":null,"Level":0,"IsAnamorphic":null},{"Codec":"DVDSUB","CodecTag":null,"Language":null,"ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":"1/90000","CodecTimeBase":null,"Title":null,"VideoRange":0,"VideoRangeType":0,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":"Undefiniert","LocalizedDefault":"Standard","LocalizedForced":"Erzwungen","LocalizedExternal":"Extern","LocalizedHearingImpaired":"H\u00F6rgesch\u00E4digt","DisplayTitle":"Undefiniert - DVDSUB","NalLengthSize":null,"IsInterlaced":false,"IsAVC":false,"ChannelLayout":null,"BitRate":null,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Height":0,"Width":0,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":2,"AspectRatio":null,"Index":3,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":null,"Level":0,"IsAnamorphic":null}],"MediaAttachments":[],"Formats":[],"Bitrate":9723238,"Timestamp":0,"RequiredHttpHeaders":{},"TranscodingUrl":null,"TranscodingSubProtocol":0,"TranscodingContainer":null,"AnalyzeDurationMs":null,"DefaultAudioStreamIndex":null,"DefaultSubtitleStreamIndex":null}
ffmpeg -analyzeduration 200M -probesize 1G -f mpegts -noautorotate -f concat -safe 0 -i "C:\Users\Edge\AppData\Local\Jellyfin\cache\transcodes\4d32af64eb4446776a7e2df132b2e4a7.concat" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:1 -map 0:2 -map -0:s -codec:v:0 libx264 -preset veryfast -crf 23 -maxrate 9275238 -bufsize 18550476 -x264opts:0 subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none -force_key_frames:0 "expr:gte(t,n_forced*3)" -sc_threshold:v:0 0 -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale=trunc(min(max(iw\,ih*a)\,min(720\,480*a))/2)*2:trunc(min(max(iw/a\,ih)\,min(720/a\,480))/2)*2,format=yuv420p" -codec:a:0 libfdk_aac -ac 2 -ab 256000 -af "volume=2" -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "C:\Users\XXX\AppData\Local\Jellyfin\cache\transcodes\2056fc15280d3f2207a9d75a5e96666b%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "C:\Users\XXX\AppData\Local\Jellyfin\cache\transcodes\2056fc15280d3f2207a9d75a5e96666b.m3u8"
ffmpeg version 6.0.1-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 13-win32 (GCC)
configuration: --prefix=/opt/ffmpeg --arch=x86_64 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --pkg-config=pkg-config --pkg-config-flags=--static --extra-version=Jellyfin --disable-ffplay --disable-debug --disable-doc --disable-sdl2 --disable-ptx-compression --disable-w32threads --enable-pthreads --enable-shared --enable-lto --enable-gpl --enable-version3 --enable-schannel --enable-iconv --enable-libxml2 --enable-zlib --enable-lzma --enable-gmp --enable-chromaprint --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libwebp --enable-libvpx --enable-libzimg --enable-libx264 --enable-libx265 --enable-libsvtav1 --enable-libdav1d --enable-libfdk-aac --enable-opencl --enable-dxva2 --enable-d3d11va --enable-amf --enable-libvpl --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
libavutil 58. 2.100 / 58. 2.100
libavcodec 60. 3.100 / 60. 3.100
libavformat 60. 3.100 / 60. 3.100
libavdevice 60. 1.100 / 60. 1.100
libavfilter 9. 3.100 / 9. 3.100
libswscale 7. 1.100 / 7. 1.100
libswresample 4. 10.100 / 4. 10.100
libpostproc 57. 1.100 / 57. 1.100
[concat @ 00000195b7f47a80] Line 2: invalid duration '925,696'
C:\Users\XXX\AppData\Local\Jellyfin\cache\transcodes\4d32af64eb4446776a7e2df132b2e4a7.concat: Invalid argument
```
### Please attach any browser or client logs here
_No response_
### Please attach any screenshots here
_No response_
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
can you try to grab that concat file it is complaining about and upload it here?
|
2024-08-30T15:19:39Z
|
0.1
|
['Jellyfin.Extensions.Tests.FormattingStreamWriterTests.Shuffle_Valid_Correct']
|
[]
|
gui-cs/Terminal.Gui
|
gui-cs__terminal-gui-3195
|
c8e54bba099763a593a3dd3427b795ab5b22dd0f
|
diff --git a/Terminal.Gui/Views/Button.cs b/Terminal.Gui/Views/Button.cs
index c5995f838d..0c90c13b8e 100644
--- a/Terminal.Gui/Views/Button.cs
+++ b/Terminal.Gui/Views/Button.cs
@@ -129,6 +129,10 @@ void Initialize (ustring text, bool is_default)
/// Gets or sets whether the <see cref="Button"/> is the default action to activate in a dialog.
/// </summary>
/// <value><c>true</c> if is default; otherwise, <c>false</c>.</value>
+ /// <remarks>
+ /// If is <see langword="true"/> the current focused view
+ /// will remain focused if the window is not closed.
+ /// </remarks>
public bool IsDefault {
get => is_default;
set {
@@ -219,7 +223,7 @@ bool ExecuteColdKey (KeyEvent ke)
bool AcceptKey ()
{
- if (!HasFocus) {
+ if (!IsDefault && !HasFocus) {
SetFocus ();
}
OnClicked ();
diff --git a/UnitTests/Views/ButtonTests.cs b/UnitTests/Views/ButtonTests.cs
index 0202db0e3b..5ef99cfa80 100644
--- a/UnitTests/Views/ButtonTests.cs
+++ b/UnitTests/Views/ButtonTests.cs
@@ -585,5 +585,21 @@ public void Pos_Center_Layout_AutoSize_False ()
TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
}
+
+ [Fact, AutoInitShutdown]
+ public void IsDefault_True_Does_Not_Get_The_Focus_On_Enter_Key ()
+ {
+ var wasClicked = false;
+ var view = new View { CanFocus = true };
+ var btn = new Button { Text = "Ok", IsDefault = true };
+ btn.Clicked += () => wasClicked = true;
+ Application.Top.Add (view, btn);
+ Application.Begin (Application.Top);
+ Assert.True (view.HasFocus);
+
+ Application.Top.ProcessColdKey (new KeyEvent (Key.Enter, new KeyModifiers ()));
+ Assert.True (view.HasFocus);
+ Assert.True (wasClicked);
+ }
}
}
|
diff --git a/testenvironments.json b/testenvironments.json
index 898ac827de..25324739d6 100644
--- a/testenvironments.json
+++ b/testenvironments.json
@@ -10,6 +10,11 @@
"type": "wsl",
"wslDistribution": "Ubuntu"
},
+ {
+ "name": "WSL-Ubuntu-20.04",
+ "type": "wsl",
+ "wslDistribution": "Ubuntu-20.04"
+ },
{
"name": "WSL-Debian",
"type": "wsl",
|
Pressing the ENTER key in a TextField should not move the focus
**Describe the bug**
Pressing the ENTER key in a TextField should not move the focus away from the TextField.
**To Reproduce**
Steps to reproduce the behavior:
1. Use the example at https://github.com/gui-cs/Terminal.Gui#sample-usage-in-c
2. Press the ENTER key (in the username TextField, which should be focused by default).
3. See that the cursor/focus is not in the TextField anymore
**Expected behavior**
I expected the focus to remain in the TextField where I've pressed the ENTER key.
|
That is the expected behavior if the button is set as default. If you set `IsDefault = false`, then the `Textfield` wouldn't loss the focus.
With `IsDefault = false`, pressing the ENTER key in the `TextField` would still trigger the default button action? If not, I do not want to do that, as that looses the ability to trigger the default button action.
IMHO, the expected behavior should be like Windows Forms control, where it does not loose focus.
> With `IsDefault = false`, pressing the ENTER key in the `TextField` would still trigger the default button action?
No, if it's false then will not trigger the button action and the `TextField` maintain the focus.
Ah, so I do not want to do that, as that looses the ability to trigger the default button action. IMHO, it should behave be like Windows Forms, where it does not loose focus. That is a much better user experience than having the focus unexpectedly bouncing to the button.
When the button is default it will get the focus but it can focus again the previous focused view with some change to the button action, It's a suggestion to do that feature :-)
In `Button.cs` it's only need do change like this:
```cs
///<inheritdoc/>
public override bool ProcessColdKey (KeyEvent kb)
{
if (!Enabled) {
return false;
}
var focused = SuperView?.MostFocused;
var res = ExecuteColdKey (kb);
focused?.SetFocus ();
return res;
}
```
I believe this is addressed. Closing. Reopen if you disagree.
@tig why do you believe its addressed? was there a commit about this?
|
2024-01-20T01:40:39Z
|
0.1
|
['Terminal.Gui.ViewTests.ButtonTests.IsDefault_True_Does_Not_Get_The_Focus_On_Enter_Key']
|
[]
|
spectreconsole/spectre.console
|
spectreconsole__spectre-console-1552
|
0e2ed511a5cfa303ba99c97ebb3f36c50cfa526f
|
diff --git a/src/Spectre.Console.Cli/Internal/Configuration/TemplateParser.cs b/src/Spectre.Console.Cli/Internal/Configuration/TemplateParser.cs
index d7eef9b05..125947280 100644
--- a/src/Spectre.Console.Cli/Internal/Configuration/TemplateParser.cs
+++ b/src/Spectre.Console.Cli/Internal/Configuration/TemplateParser.cs
@@ -86,7 +86,7 @@ public static OptionResult ParseOptionTemplate(string template)
foreach (var character in token.Value)
{
- if (!char.IsLetterOrDigit(character) && character != '-' && character != '_')
+ if (!char.IsLetterOrDigit(character) && character != '-' && character != '_' && character != '?')
{
throw CommandTemplateException.InvalidCharacterInOptionName(template, token, character);
}
diff --git a/src/Spectre.Console.Cli/Internal/Parsing/CommandTreeParser.cs b/src/Spectre.Console.Cli/Internal/Parsing/CommandTreeParser.cs
index e4fad73a3..d985dcbd2 100644
--- a/src/Spectre.Console.Cli/Internal/Parsing/CommandTreeParser.cs
+++ b/src/Spectre.Console.Cli/Internal/Parsing/CommandTreeParser.cs
@@ -21,7 +21,7 @@ public CommandTreeParser(CommandModel configuration, CaseSensitivity caseSensiti
{
_configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
_parsingMode = parsingMode ?? _configuration.ParsingMode;
- _help = new CommandOptionAttribute("-h|--help");
+ _help = new CommandOptionAttribute("-?|-h|--help");
_convertFlagsToRemainingArguments = convertFlagsToRemainingArguments ?? false;
CaseSensitivity = caseSensitivity;
diff --git a/src/Spectre.Console.Cli/Internal/Parsing/CommandTreeTokenizer.cs b/src/Spectre.Console.Cli/Internal/Parsing/CommandTreeTokenizer.cs
index 27e6edbc6..840b072c7 100644
--- a/src/Spectre.Console.Cli/Internal/Parsing/CommandTreeTokenizer.cs
+++ b/src/Spectre.Console.Cli/Internal/Parsing/CommandTreeTokenizer.cs
@@ -176,7 +176,7 @@ private static IEnumerable<CommandTreeToken> ScanShortOptions(CommandTreeTokeniz
break;
}
- if (char.IsLetter(current))
+ if (char.IsLetter(current) || current is '?')
{
context.AddRemaining(current);
reader.Read(); // Consume
|
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root.QuestionMark.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root.QuestionMark.verified.txt
new file mode 100644
index 000000000..0432fe41a
--- /dev/null
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root.QuestionMark.verified.txt
@@ -0,0 +1,10 @@
+USAGE:
+ myapp [OPTIONS] <COMMAND>
+
+OPTIONS:
+ -h, --help Prints help information
+
+COMMANDS:
+ dog <AGE> The dog command
+ horse The horse command
+ giraffe <LENGTH> The giraffe command
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Command.QuestionMark.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Command.QuestionMark.verified.txt
new file mode 100644
index 000000000..03c68750d
--- /dev/null
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Command.QuestionMark.verified.txt
@@ -0,0 +1,17 @@
+DESCRIPTION:
+The horse command.
+
+USAGE:
+ myapp horse [LEGS] [OPTIONS]
+
+ARGUMENTS:
+ [LEGS] The number of legs
+
+OPTIONS:
+ DEFAULT
+ -h, --help Prints help information
+ -a, --alive Indicates whether or not the animal is alive
+ -n, --name <VALUE>
+ -d, --day <MON|TUE>
+ --file food.txt
+ --directory
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Help.cs b/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Help.cs
index 9ce30cc24..8d3af800f 100644
--- a/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Help.cs
+++ b/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Help.cs
@@ -28,6 +28,27 @@ public Task Should_Output_Root_Correctly()
return Verifier.Verify(result.Output);
}
+ [Fact]
+ [Expectation("Root", "QuestionMark")]
+ public Task Should_Output_Root_Correctly_QuestionMark()
+ {
+ // Given
+ var fixture = new CommandAppTester();
+ fixture.Configure(configurator =>
+ {
+ configurator.SetApplicationName("myapp");
+ configurator.AddCommand<DogCommand>("dog");
+ configurator.AddCommand<HorseCommand>("horse");
+ configurator.AddCommand<GiraffeCommand>("giraffe");
+ });
+
+ // When
+ var result = fixture.Run("-?");
+
+ // Then
+ return Verifier.Verify(result.Output);
+ }
+
[Fact]
[Expectation("Root_Command")]
public Task Should_Output_Root_Command_Correctly()
@@ -49,6 +70,27 @@ public Task Should_Output_Root_Command_Correctly()
return Verifier.Verify(result.Output);
}
+ [Fact]
+ [Expectation("Root_Command", "QuestionMark")]
+ public Task Should_Output_Root_Command_Correctly_QuestionMark()
+ {
+ // Given
+ var fixture = new CommandAppTester();
+ fixture.Configure(configurator =>
+ {
+ configurator.SetApplicationName("myapp");
+ configurator.AddCommand<DogCommand>("dog");
+ configurator.AddCommand<HorseCommand>("horse");
+ configurator.AddCommand<GiraffeCommand>("giraffe");
+ });
+
+ // When
+ var result = fixture.Run("horse", "-?");
+
+ // Then
+ return Verifier.Verify(result.Output);
+ }
+
[Fact]
[Expectation("Hidden_Commands")]
public Task Should_Skip_Hidden_Commands()
|
Add '-?' as an additional alias for '-h' and '--help', just like 'dotnet -?'
It's second nature for me to just type `-?` to get help on stuff. Even in the GitHub CLI, typing `gh -?` (although not an official option to get help) gets you the default help :).
I'd say it's a common enough shorthand for help that it deserves being supported built-in.
|
Sounds like a reasonable thing to add π
|
2024-05-17T21:10:33Z
|
0.1
|
['Spectre.Console.Tests.Unit.Cli.CommandAppTests+Help.Should_Output_Root_Correctly_QuestionMark', 'Spectre.Console.Tests.Unit.Cli.CommandAppTests+Help.Should_Output_Root_Command_Correctly_QuestionMark']
|
[]
|
spectreconsole/spectre.console
|
spectreconsole__spectre-console-1531
|
c5e11626b521c47c45339d90ae7dcebc736a3224
|
diff --git a/dotnet-tools.json b/dotnet-tools.json
index b0036d859..a7f9d036b 100644
--- a/dotnet-tools.json
+++ b/dotnet-tools.json
@@ -13,6 +13,12 @@
"commands": [
"dotnet-example"
]
+ },
+ "verify.tool": {
+ "version": "0.6.0",
+ "commands": [
+ "dotnet-verify"
+ ]
}
}
}
\ No newline at end of file
diff --git a/src/Spectre.Console.Cli/ConfiguratorExtensions.cs b/src/Spectre.Console.Cli/ConfiguratorExtensions.cs
index eb3f1be19..80895e302 100644
--- a/src/Spectre.Console.Cli/ConfiguratorExtensions.cs
+++ b/src/Spectre.Console.Cli/ConfiguratorExtensions.cs
@@ -82,7 +82,7 @@ public static IConfigurator SetApplicationName(this IConfigurator configurator,
}
/// <summary>
- /// Overrides the auto-detected version of the application.
+ /// Sets the version of the application.
/// </summary>
/// <param name="configurator">The configurator.</param>
/// <param name="version">The version of application.</param>
@@ -98,6 +98,25 @@ public static IConfigurator SetApplicationVersion(this IConfigurator configurato
return configurator;
}
+ /// <summary>
+ /// Uses the version retrieved from the <see cref="AssemblyInformationalVersionAttribute"/>
+ /// as the application's version.
+ /// </summary>
+ /// <param name="configurator">The configurator.</param>
+ /// <returns>A configurator that can be used to configure the application further.</returns>
+ public static IConfigurator UseAssemblyInformationalVersion(this IConfigurator configurator)
+ {
+ if (configurator == null)
+ {
+ throw new ArgumentNullException(nameof(configurator));
+ }
+
+ configurator.Settings.ApplicationVersion =
+ VersionHelper.GetVersion(Assembly.GetEntryAssembly());
+
+ return configurator;
+ }
+
/// <summary>
/// Hides the <c>DEFAULT</c> column that lists default values coming from the
/// <see cref="DefaultValueAttribute"/> in the options help text.
diff --git a/src/Spectre.Console.Cli/Help/HelpProvider.cs b/src/Spectre.Console.Cli/Help/HelpProvider.cs
index 222b3d4ad..ca18f0fbb 100644
--- a/src/Spectre.Console.Cli/Help/HelpProvider.cs
+++ b/src/Spectre.Console.Cli/Help/HelpProvider.cs
@@ -41,7 +41,7 @@ private sealed class HelpArgument
public bool Required { get; }
public string? Description { get; }
- public HelpArgument(string name, int position, bool required, string? description)
+ private HelpArgument(string name, int position, bool required, string? description)
{
Name = name;
Position = position;
@@ -68,7 +68,7 @@ private sealed class HelpOption
public string? Description { get; }
public object? DefaultValue { get; }
- public HelpOption(string? @short, string? @long, string? @value, bool? valueIsOptional, string? description, object? defaultValue)
+ private HelpOption(string? @short, string? @long, string? @value, bool? valueIsOptional, string? description, object? defaultValue)
{
Short = @short;
Long = @long;
@@ -78,17 +78,27 @@ public HelpOption(string? @short, string? @long, string? @value, bool? valueIsOp
DefaultValue = defaultValue;
}
- public static IReadOnlyList<HelpOption> Get(ICommandInfo? command, HelpProviderResources resources)
+ public static IReadOnlyList<HelpOption> Get(
+ ICommandModel model,
+ ICommandInfo? command,
+ HelpProviderResources resources)
{
- var parameters = new List<HelpOption>();
- parameters.Add(new HelpOption("h", "help", null, null, resources.PrintHelpDescription, null));
+ var parameters = new List<HelpOption>
+ {
+ new HelpOption("h", "help", null, null, resources.PrintHelpDescription, null),
+ };
// Version information applies to the entire application
// Include the "-v" option in the help when at the root of the command line application
// Don't allow the "-v" option if users have specified one or more sub-commands
- if ((command == null || command?.Parent == null) && !(command?.IsBranch ?? false))
+ if ((command?.Parent == null) && !(command?.IsBranch ?? false))
{
- parameters.Add(new HelpOption("v", "version", null, null, resources.PrintVersionDescription, null));
+ // Only show the version command if there is an
+ // application version set.
+ if (model.ApplicationVersion != null)
+ {
+ parameters.Add(new HelpOption("v", "version", null, null, resources.PrintVersionDescription, null));
+ }
}
parameters.AddRange(command?.Parameters.OfType<ICommandOption>().Where(o => !o.IsHidden).Select(o =>
@@ -101,11 +111,6 @@ public static IReadOnlyList<HelpOption> Get(ICommandInfo? command, HelpProviderR
}
}
- internal Composer NewComposer()
- {
- return new Composer(RenderMarkupInline);
- }
-
/// <summary>
/// Initializes a new instance of the <see cref="HelpProvider"/> class.
/// </summary>
@@ -383,7 +388,7 @@ public virtual IEnumerable<IRenderable> GetArguments(ICommandModel model, IComma
public virtual IEnumerable<IRenderable> GetOptions(ICommandModel model, ICommandInfo? command)
{
// Collect all options into a single structure.
- var parameters = HelpOption.Get(command, resources);
+ var parameters = HelpOption.Get(model, command, resources);
if (parameters.Count == 0)
{
return Array.Empty<IRenderable>();
@@ -420,7 +425,7 @@ public virtual IEnumerable<IRenderable> GetOptions(ICommandModel model, ICommand
if (defaultValueColumn)
{
- columns.Add(GetOptionDefaultValue(option.DefaultValue));
+ columns.Add(GetDefaultValueForOption(option.DefaultValue));
}
columns.Add(NewComposer().Text(option.Description?.TrimEnd('.') ?? " "));
@@ -433,60 +438,6 @@ public virtual IEnumerable<IRenderable> GetOptions(ICommandModel model, ICommand
return result;
}
- private IRenderable GetOptionParts(HelpOption option)
- {
- var composer = NewComposer();
-
- if (option.Short != null)
- {
- composer.Text("-").Text(option.Short);
- if (option.Long != null)
- {
- composer.Text(", ");
- }
- }
- else
- {
- composer.Text(" ");
- if (option.Long != null)
- {
- composer.Text(" ");
- }
- }
-
- if (option.Long != null)
- {
- composer.Text("--").Text(option.Long);
- }
-
- if (option.Value != null)
- {
- composer.Text(" ");
- if (option.ValueIsOptional ?? false)
- {
- composer.Style(helpStyles?.Options?.OptionalOption ?? Style.Plain, $"[{option.Value}]");
- }
- else
- {
- composer.Style(helpStyles?.Options?.RequiredOption ?? Style.Plain, $"<{option.Value}>");
- }
- }
-
- return composer;
- }
-
- private IRenderable GetOptionDefaultValue(object? defaultValue)
- {
- return defaultValue switch
- {
- null => NewComposer().Text(" "),
- "" => NewComposer().Text(" "),
- Array { Length: 0 } => NewComposer().Text(" "),
- Array array => NewComposer().Join(", ", array.Cast<object>().Select(o => NewComposer().Style(helpStyles?.Options?.DefaultValue ?? Style.Plain, o.ToString() ?? string.Empty))),
- _ => NewComposer().Style(helpStyles?.Options?.DefaultValue ?? Style.Plain, defaultValue?.ToString() ?? string.Empty),
- };
- }
-
/// <summary>
/// Gets the commands section of the help information.
/// </summary>
@@ -556,4 +507,63 @@ public virtual IEnumerable<IRenderable> GetFooter(ICommandModel model, ICommandI
{
yield break;
}
+
+ private Composer NewComposer()
+ {
+ return new Composer(RenderMarkupInline);
+ }
+
+ private IRenderable GetOptionParts(HelpOption option)
+ {
+ var composer = NewComposer();
+
+ if (option.Short != null)
+ {
+ composer.Text("-").Text(option.Short);
+ if (option.Long != null)
+ {
+ composer.Text(", ");
+ }
+ }
+ else
+ {
+ composer.Text(" ");
+ if (option.Long != null)
+ {
+ composer.Text(" ");
+ }
+ }
+
+ if (option.Long != null)
+ {
+ composer.Text("--").Text(option.Long);
+ }
+
+ if (option.Value != null)
+ {
+ composer.Text(" ");
+ if (option.ValueIsOptional ?? false)
+ {
+ composer.Style(helpStyles?.Options?.OptionalOption ?? Style.Plain, $"[{option.Value}]");
+ }
+ else
+ {
+ composer.Style(helpStyles?.Options?.RequiredOption ?? Style.Plain, $"<{option.Value}>");
+ }
+ }
+
+ return composer;
+ }
+
+ private Composer GetDefaultValueForOption(object? defaultValue)
+ {
+ return defaultValue switch
+ {
+ null => NewComposer().Text(" "),
+ "" => NewComposer().Text(" "),
+ Array { Length: 0 } => NewComposer().Text(" "),
+ Array array => NewComposer().Join(", ", array.Cast<object>().Select(o => NewComposer().Style(helpStyles?.Options?.DefaultValue ?? Style.Plain, o.ToString() ?? string.Empty))),
+ _ => NewComposer().Style(helpStyles?.Options?.DefaultValue ?? Style.Plain, defaultValue?.ToString() ?? string.Empty),
+ };
+ }
}
\ No newline at end of file
diff --git a/src/Spectre.Console.Cli/Help/ICommandModel.cs b/src/Spectre.Console.Cli/Help/ICommandModel.cs
index e7fe5f728..2872bf889 100644
--- a/src/Spectre.Console.Cli/Help/ICommandModel.cs
+++ b/src/Spectre.Console.Cli/Help/ICommandModel.cs
@@ -9,4 +9,9 @@ public interface ICommandModel : ICommandContainer
/// Gets the name of the application.
/// </summary>
string ApplicationName { get; }
+
+ /// <summary>
+ /// Gets the version of the application.
+ /// </summary>
+ string? ApplicationVersion { get; }
}
diff --git a/src/Spectre.Console.Cli/Internal/CommandExecutor.cs b/src/Spectre.Console.Cli/Internal/CommandExecutor.cs
index 2c2b1594f..22eeb2084 100644
--- a/src/Spectre.Console.Cli/Internal/CommandExecutor.cs
+++ b/src/Spectre.Console.Cli/Internal/CommandExecutor.cs
@@ -39,9 +39,12 @@ public async Task<int> Execute(IConfiguration configuration, IEnumerable<string>
if (firstArgument.Equals("--version", StringComparison.OrdinalIgnoreCase) ||
firstArgument.Equals("-v", StringComparison.OrdinalIgnoreCase))
{
- var console = configuration.Settings.Console.GetConsole();
- console.WriteLine(ResolveApplicationVersion(configuration));
- return 0;
+ if (configuration.Settings.ApplicationVersion != null)
+ {
+ var console = configuration.Settings.Console.GetConsole();
+ console.MarkupLine(configuration.Settings.ApplicationVersion);
+ return 0;
+ }
}
}
}
@@ -126,13 +129,6 @@ private CommandTreeParserResult ParseCommandLineArguments(CommandModel model, Co
return parsedResult;
}
- private static string ResolveApplicationVersion(IConfiguration configuration)
- {
- return
- configuration.Settings.ApplicationVersion ?? // potential override
- VersionHelper.GetVersion(Assembly.GetEntryAssembly());
- }
-
private static async Task<int> Execute(
CommandTree leaf,
CommandTree tree,
diff --git a/src/Spectre.Console.Cli/Internal/Modelling/CommandModel.cs b/src/Spectre.Console.Cli/Internal/Modelling/CommandModel.cs
index 3da02da4b..721960bd3 100644
--- a/src/Spectre.Console.Cli/Internal/Modelling/CommandModel.cs
+++ b/src/Spectre.Console.Cli/Internal/Modelling/CommandModel.cs
@@ -3,6 +3,7 @@ namespace Spectre.Console.Cli;
internal sealed class CommandModel : ICommandContainer, ICommandModel
{
public string? ApplicationName { get; }
+ public string? ApplicationVersion { get; }
public ParsingMode ParsingMode { get; }
public IList<CommandInfo> Commands { get; }
public IList<string[]> Examples { get; }
@@ -20,9 +21,10 @@ public CommandModel(
IEnumerable<string[]> examples)
{
ApplicationName = settings.ApplicationName;
+ ApplicationVersion = settings.ApplicationVersion;
ParsingMode = settings.ParsingMode;
- Commands = new List<CommandInfo>(commands ?? Array.Empty<CommandInfo>());
- Examples = new List<string[]>(examples ?? Array.Empty<string[]>());
+ Commands = new List<CommandInfo>(commands);
+ Examples = new List<string[]>(examples);
}
/// <summary>
|
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/ArgumentOrder.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/ArgumentOrder.Output.verified.txt
index 6e29ed297..9a82776df 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/ArgumentOrder.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/ArgumentOrder.Output.verified.txt
@@ -1,4 +1,4 @@
-USAGE:
+ο»ΏUSAGE:
myapp <FOO> <BAR> <BAZ> <CORGI> [QUX] [OPTIONS]
ARGUMENTS:
@@ -9,5 +9,4 @@ ARGUMENTS:
[QUX]
OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
\ No newline at end of file
+ -h, --help Prints help information
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Custom_Help_Configured_By_Instance.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Custom_Help_Configured_By_Instance.Output.verified.txt
index e4a56cd59..f2bd53972 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Custom_Help_Configured_By_Instance.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Custom_Help_Configured_By_Instance.Output.verified.txt
@@ -1,15 +1,14 @@
---------------------------------------
---- CUSTOM HELP PROVIDER ---
---------------------------------------
-
-USAGE:
- myapp [OPTIONS] <COMMAND>
-
-OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
-
-COMMANDS:
- dog <AGE> The dog command
-
+ο»Ώ--------------------------------------
+--- CUSTOM HELP PROVIDER ---
+--------------------------------------
+
+USAGE:
+ myapp [OPTIONS] <COMMAND>
+
+OPTIONS:
+ -h, --help Prints help information
+
+COMMANDS:
+ dog <AGE> The dog command
+
Version 1.0
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Custom_Help_Registered_By_Instance.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Custom_Help_Registered_By_Instance.Output.verified.txt
index ad99fbb63..f2bd53972 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Custom_Help_Registered_By_Instance.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Custom_Help_Registered_By_Instance.Output.verified.txt
@@ -1,4 +1,4 @@
---------------------------------------
+ο»Ώ--------------------------------------
--- CUSTOM HELP PROVIDER ---
--------------------------------------
@@ -6,8 +6,7 @@ USAGE:
myapp [OPTIONS] <COMMAND>
OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
+ -h, --help Prints help information
COMMANDS:
dog <AGE> The dog command
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default.Output.verified.txt
index aa1978d8b..b53a06eb8 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default.Output.verified.txt
@@ -1,4 +1,4 @@
-DESCRIPTION:
+ο»ΏDESCRIPTION:
The lion command.
USAGE:
@@ -10,8 +10,7 @@ ARGUMENTS:
OPTIONS:
DEFAULT
- -h, --help Prints help information
- -v, --version Prints version information
+ -h, --help Prints help information
-a, --alive Indicates whether or not the animal is alive
-n, --name <VALUE>
--agility <VALUE> 10 The agility between 0 and 100
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Examples.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Examples.Output.verified.txt
index cd5b1e4fe..58c2ec53b 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Examples.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Examples.Output.verified.txt
@@ -1,4 +1,4 @@
-DESCRIPTION:
+ο»ΏDESCRIPTION:
The dog command.
USAGE:
@@ -18,7 +18,6 @@ ARGUMENTS:
OPTIONS:
-h, --help Prints help information
- -v, --version Prints version information
-a, --alive Indicates whether or not the animal is alive
-n, --name <VALUE>
-g, --good-boy
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args.Output.verified.txt
index aa1978d8b..b53a06eb8 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args.Output.verified.txt
@@ -1,4 +1,4 @@
-DESCRIPTION:
+ο»ΏDESCRIPTION:
The lion command.
USAGE:
@@ -10,8 +10,7 @@ ARGUMENTS:
OPTIONS:
DEFAULT
- -h, --help Prints help information
- -v, --version Prints version information
+ -h, --help Prints help information
-a, --alive Indicates whether or not the animal is alive
-n, --name <VALUE>
--agility <VALUE> 10 The agility between 0 and 100
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional.Output_DE.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional.Output_DE.verified.txt
index ba0602d87..8f21e0057 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional.Output_DE.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional.Output_DE.verified.txt
@@ -1,4 +1,4 @@
-BESCHREIBUNG:
+ο»ΏBESCHREIBUNG:
The lion command.
VERWENDUNG:
@@ -14,7 +14,6 @@ ARGUMENTE:
OPTIONEN:
STANDARDWERT
-h, --help Zeigt Hilfe an
- -v, --version Zeigt Versionsinformationen an
-a, --alive Indicates whether or not the animal is alive
-n, --name <VALUE>
--agility <VALUE> 10 The agility between 0 and 100
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional.Output_EN.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional.Output_EN.verified.txt
index d4a593379..905156f8a 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional.Output_EN.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional.Output_EN.verified.txt
@@ -1,4 +1,4 @@
-DESCRIPTION:
+ο»ΏDESCRIPTION:
The lion command.
USAGE:
@@ -13,8 +13,7 @@ ARGUMENTS:
OPTIONS:
DEFAULT
- -h, --help Prints help information
- -v, --version Prints version information
+ -h, --help Prints help information
-a, --alive Indicates whether or not the animal is alive
-n, --name <VALUE>
--agility <VALUE> 10 The agility between 0 and 100
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional.Output_FR.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional.Output_FR.verified.txt
index 126de22d6..a555c1c1c 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional.Output_FR.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional.Output_FR.verified.txt
@@ -1,4 +1,4 @@
-DESCRIPTION:
+ο»ΏDESCRIPTION:
The lion command.
UTILISATION:
@@ -13,8 +13,7 @@ ARGUMENTS:
OPTIONS:
DΓFAUT
- -h, --help Affiche l'aide
- -v, --version Affiche la version
+ -h, --help Affiche l'aide
-a, --alive Indicates whether or not the animal is alive
-n, --name <VALUE>
--agility <VALUE> 10 The agility between 0 and 100
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional.Output_SV.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional.Output_SV.verified.txt
index 2292492b8..45fd6c0c4 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional.Output_SV.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional.Output_SV.verified.txt
@@ -1,4 +1,4 @@
-BESKRIVNING:
+ο»ΏBESKRIVNING:
The lion command.
ANVΓNDING:
@@ -14,7 +14,6 @@ ARGUMENT:
VAL:
STANDARD
-h, --help Skriver ut hjΓ€lpinformation
- -v, --version Skriver ut versionsnummer
-a, --alive Indicates whether or not the animal is alive
-n, --name <VALUE>
--agility <VALUE> 10 The agility between 0 and 100
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional_Style_BoldHeadings.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional_Style_BoldHeadings.Output.verified.txt
index 4bea738da..5b0f4264a 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional_Style_BoldHeadings.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional_Style_BoldHeadings.Output.verified.txt
@@ -1,4 +1,4 @@
-[bold]DESCRIPTION:[/]
+ο»Ώ[bold]DESCRIPTION:[/]
The lion command.
[bold]USAGE:[/]
@@ -14,7 +14,6 @@ The lion command.
[]OPTIONS:[/]
[]DEFAULT[/]
-h, --help Prints help information
- -v, --version Prints version information
-a, --alive Indicates whether or not the animal is alive
-n, --name []<VALUE>[/]
--agility []<VALUE>[/] []10[/] The agility between 0 and 100
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional_Style_Default.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional_Style_Default.Output.verified.txt
index 30421ace0..82570d3aa 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional_Style_Default.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional_Style_Default.Output.verified.txt
@@ -1,4 +1,4 @@
-[yellow]DESCRIPTION:[/]
+ο»Ώ[yellow]DESCRIPTION:[/]
The lion command.
[yellow]USAGE:[/]
@@ -14,7 +14,6 @@ The lion command.
[yellow]OPTIONS:[/]
[lime]DEFAULT[/]
-h, --help Prints help information
- -v, --version Prints version information
-a, --alive Indicates whether or not the animal is alive
-n, --name [silver]<VALUE>[/]
--agility [silver]<VALUE>[/] [bold]10[/] The agility between 0 and 100
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional_Style_None.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional_Style_None.Output.verified.txt
index a0bb7b25a..2b92a199c 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional_Style_None.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Default_Without_Args_Additional_Style_None.Output.verified.txt
@@ -1,4 +1,4 @@
-[]DESCRIPTION:[/]
+ο»Ώ[]DESCRIPTION:[/]
The lion command.
[]USAGE:[/]
@@ -14,7 +14,6 @@ The lion command.
[]OPTIONS:[/]
[]DEFAULT[/]
-h, --help Prints help information
- -v, --version Prints version information
-a, --alive Indicates whether or not the animal is alive
-n, --name []<VALUE>[/]
--agility []<VALUE>[/] []10[/] The agility between 0 and 100
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Description_No_Trailing_Period.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Description_No_Trailing_Period.Output.verified.txt
index b53e7717e..9662e05f6 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Description_No_Trailing_Period.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Description_No_Trailing_Period.Output.verified.txt
@@ -1,9 +1,8 @@
-USAGE:
+ο»ΏUSAGE:
myapp [OPTIONS] <COMMAND>
OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
+ -h, --help Prints help information
COMMANDS:
dog <AGE> The dog command.
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Hidden_Command_Options.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Hidden_Command_Options.Output.verified.txt
index 7288aefa5..b96464bf4 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Hidden_Command_Options.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Hidden_Command_Options.Output.verified.txt
@@ -1,10 +1,9 @@
-USAGE:
+ο»ΏUSAGE:
myapp <FOO> [OPTIONS]
ARGUMENTS:
<FOO> Dummy argument FOO
OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
- --baz Dummy option BAZ
\ No newline at end of file
+ -h, --help Prints help information
+ --baz Dummy option BAZ
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Hidden_Commands.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Hidden_Commands.Output.verified.txt
index 6a792dad6..212276974 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Hidden_Commands.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Hidden_Commands.Output.verified.txt
@@ -1,9 +1,8 @@
-USAGE:
+ο»ΏUSAGE:
myapp [OPTIONS] <COMMAND>
OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
+ -h, --help Prints help information
COMMANDS:
dog <AGE> The dog command
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/NoDescription.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/NoDescription.Output.verified.txt
index f214d32a4..7e3e079cd 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/NoDescription.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/NoDescription.Output.verified.txt
@@ -1,9 +1,8 @@
-USAGE:
+ο»ΏUSAGE:
myapp [OPTIONS] <COMMAND>
OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
+ -h, --help Prints help information
COMMANDS:
bar
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/NoVersion.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/NoVersion.Output.verified.txt
new file mode 100644
index 000000000..9a82776df
--- /dev/null
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/NoVersion.Output.verified.txt
@@ -0,0 +1,12 @@
+ο»ΏUSAGE:
+ myapp <FOO> <BAR> <BAZ> <CORGI> [QUX] [OPTIONS]
+
+ARGUMENTS:
+ <FOO>
+ <BAR>
+ <BAZ>
+ <CORGI>
+ [QUX]
+
+OPTIONS:
+ -h, --help Prints help information
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root.Output.verified.txt
index 366b6b38d..aa3dcc3bf 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root.Output.verified.txt
@@ -1,9 +1,8 @@
-USAGE:
+ο»ΏUSAGE:
myapp [OPTIONS] <COMMAND>
OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
+ -h, --help Prints help information
COMMANDS:
dog <AGE> The dog command
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Command.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Command.Output.verified.txt
index c660618c1..2c6e498be 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Command.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Command.Output.verified.txt
@@ -1,4 +1,4 @@
-DESCRIPTION:
+ο»ΏDESCRIPTION:
The horse command.
USAGE:
@@ -10,7 +10,6 @@ ARGUMENTS:
OPTIONS:
DEFAULT
-h, --help Prints help information
- -v, --version Prints version information
-a, --alive Indicates whether or not the animal is alive
-n, --name <VALUE>
-d, --day <MON|TUE>
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples.Output.verified.txt
index 3488e38c2..82ba4675d 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples.Output.verified.txt
@@ -1,4 +1,4 @@
-USAGE:
+ο»ΏUSAGE:
myapp [OPTIONS] <COMMAND>
EXAMPLES:
@@ -16,8 +16,7 @@ EXAMPLES:
myapp horse --name Spirit
OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
+ -h, --help Prints help information
COMMANDS:
dog <AGE> The dog command
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Children.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Children.Output.verified.txt
index 47e373aa3..e2b67c8a3 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Children.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Children.Output.verified.txt
@@ -1,4 +1,4 @@
-USAGE:
+ο»ΏUSAGE:
myapp [OPTIONS] <COMMAND>
EXAMPLES:
@@ -9,8 +9,7 @@ EXAMPLES:
myapp dog --name Daisy
OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
+ -h, --help Prints help information
COMMANDS:
dog <AGE> The dog command
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Children_Eight.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Children_Eight.Output.verified.txt
index 3e5a6d939..7b486e1fe 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Children_Eight.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Children_Eight.Output.verified.txt
@@ -1,20 +1,19 @@
-USAGE:
- myapp [OPTIONS] <COMMAND>
-
-EXAMPLES:
- myapp dog --name Rufus --age 12 --good-boy
- myapp dog --name Luna
- myapp dog --name Charlie
- myapp dog --name Bella
- myapp dog --name Daisy
- myapp dog --name Milo
- myapp horse --name Brutus
- myapp horse --name Sugar --IsAlive false
-
-OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
-
-COMMANDS:
- dog <AGE> The dog command
+ο»ΏUSAGE:
+ myapp [OPTIONS] <COMMAND>
+
+EXAMPLES:
+ myapp dog --name Rufus --age 12 --good-boy
+ myapp dog --name Luna
+ myapp dog --name Charlie
+ myapp dog --name Bella
+ myapp dog --name Daisy
+ myapp dog --name Milo
+ myapp horse --name Brutus
+ myapp horse --name Sugar --IsAlive false
+
+OPTIONS:
+ -h, --help Prints help information
+
+COMMANDS:
+ dog <AGE> The dog command
horse The horse command
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Children_None.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Children_None.Output.verified.txt
index 3377d2a96..212276974 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Children_None.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Children_None.Output.verified.txt
@@ -1,10 +1,9 @@
-USAGE:
- myapp [OPTIONS] <COMMAND>
-
-OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
-
-COMMANDS:
- dog <AGE> The dog command
+ο»ΏUSAGE:
+ myapp [OPTIONS] <COMMAND>
+
+OPTIONS:
+ -h, --help Prints help information
+
+COMMANDS:
+ dog <AGE> The dog command
horse The horse command
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Children_Twelve.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Children_Twelve.Output.verified.txt
index 8924b5555..82ba4675d 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Children_Twelve.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Children_Twelve.Output.verified.txt
@@ -1,24 +1,23 @@
-USAGE:
- myapp [OPTIONS] <COMMAND>
-
-EXAMPLES:
- myapp dog --name Rufus --age 12 --good-boy
- myapp dog --name Luna
- myapp dog --name Charlie
- myapp dog --name Bella
- myapp dog --name Daisy
- myapp dog --name Milo
- myapp horse --name Brutus
- myapp horse --name Sugar --IsAlive false
- myapp horse --name Cash
- myapp horse --name Dakota
- myapp horse --name Cisco
- myapp horse --name Spirit
-
-OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
-
-COMMANDS:
- dog <AGE> The dog command
+ο»ΏUSAGE:
+ myapp [OPTIONS] <COMMAND>
+
+EXAMPLES:
+ myapp dog --name Rufus --age 12 --good-boy
+ myapp dog --name Luna
+ myapp dog --name Charlie
+ myapp dog --name Bella
+ myapp dog --name Daisy
+ myapp dog --name Milo
+ myapp horse --name Brutus
+ myapp horse --name Sugar --IsAlive false
+ myapp horse --name Cash
+ myapp horse --name Dakota
+ myapp horse --name Cisco
+ myapp horse --name Spirit
+
+OPTIONS:
+ -h, --help Prints help information
+
+COMMANDS:
+ dog <AGE> The dog command
horse The horse command
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Leafs.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Leafs.Output.verified.txt
index 8b753619b..088dd1b82 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Leafs.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Leafs.Output.verified.txt
@@ -1,4 +1,4 @@
-USAGE:
+ο»ΏUSAGE:
myapp [OPTIONS] <COMMAND>
EXAMPLES:
@@ -9,8 +9,7 @@ EXAMPLES:
myapp animal dog --name Daisy
OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
+ -h, --help Prints help information
COMMANDS:
animal The animal command
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Leafs_Eight.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Leafs_Eight.Output.verified.txt
index 63bded9a9..e236c9b54 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Leafs_Eight.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Leafs_Eight.Output.verified.txt
@@ -12,8 +12,7 @@ EXAMPLES:
myapp animal horse --name Sugar --IsAlive false
OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
+ -h, --help Prints help information
COMMANDS:
animal The animal command
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Leafs_None.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Leafs_None.Output.verified.txt
index 53228a04c..75de3a148 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Leafs_None.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Leafs_None.Output.verified.txt
@@ -1,9 +1,8 @@
-USAGE:
+ο»ΏUSAGE:
myapp [OPTIONS] <COMMAND>
OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
+ -h, --help Prints help information
COMMANDS:
animal The animal command
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Leafs_Twelve.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Leafs_Twelve.Output.verified.txt
index 07178cbc7..b6b89b68a 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Leafs_Twelve.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Root_Examples_Leafs_Twelve.Output.verified.txt
@@ -16,8 +16,7 @@ EXAMPLES:
myapp animal horse --name Spirit
OPTIONS:
- -h, --help Prints help information
- -v, --version Prints version information
+ -h, --help Prints help information
COMMANDS:
animal The animal command
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Help/Version.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Help/Version.Output.verified.txt
new file mode 100644
index 000000000..a07a26663
--- /dev/null
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Help/Version.Output.verified.txt
@@ -0,0 +1,13 @@
+ο»ΏUSAGE:
+ myapp <FOO> <BAR> <BAZ> <CORGI> [QUX] [OPTIONS]
+
+ARGUMENTS:
+ <FOO>
+ <BAR>
+ <BAZ>
+ <CORGI>
+ [QUX]
+
+OPTIONS:
+ -h, --help Prints help information
+ -v, --version Prints version information
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Help.cs b/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Help.cs
index 3c2b8ca8d..9ce30cc24 100644
--- a/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Help.cs
+++ b/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Help.cs
@@ -950,6 +950,45 @@ public Task Should_List_Arguments_In_Correct_Order()
return Verifier.Verify(result.Output);
}
+ [Fact]
+ [Expectation("NoVersion")]
+ public Task Should_Not_Include_Application_Version_If_Not_Set()
+ {
+ // Given
+ var fixture = new CommandAppTester();
+ fixture.SetDefaultCommand<GenericCommand<ArgumentOrderSettings>>();
+ fixture.Configure(config =>
+ {
+ config.SetApplicationName("myapp");
+ });
+
+ // When
+ var result = fixture.Run("--help");
+
+ // Then
+ return Verifier.Verify(result.Output);
+ }
+
+ [Fact]
+ [Expectation("Version")]
+ public Task Should_Include_Application_Version_If_Set()
+ {
+ // Given
+ var fixture = new CommandAppTester();
+ fixture.SetDefaultCommand<GenericCommand<ArgumentOrderSettings>>();
+ fixture.Configure(config =>
+ {
+ config.SetApplicationName("myapp");
+ config.SetApplicationVersion("0.49.1");
+ });
+
+ // When
+ var result = fixture.Run("--help");
+
+ // Then
+ return Verifier.Verify(result.Output);
+ }
+
[Fact]
[Expectation("Hidden_Command_Options")]
public Task Should_Not_Show_Hidden_Command_Options()
diff --git a/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Version.cs b/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Version.cs
index e9e38dc2f..e0a48ee26 100644
--- a/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Version.cs
+++ b/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Version.cs
@@ -34,6 +34,24 @@ public void Should_Output_Application_Version_To_The_Console_With_No_Command()
result.Output.ShouldBe("1.0");
}
+ [Fact]
+ public void Should_Not_Display_Version_If_Not_Specified()
+ {
+ // Given
+ var fixture = new CommandAppTester();
+ fixture.Configure(configurator =>
+ {
+ configurator.AddCommand<EmptyCommand>("empty");
+ });
+
+ // When
+ var result = fixture.Run("--version");
+
+ // Then
+ result.ExitCode.ShouldNotBe(0);
+ result.Output.ShouldStartWith("Error: Unexpected option 'version'");
+ }
+
[Fact]
public void Should_Execute_Command_Not_Output_Application_Version_To_The_Console()
{
@@ -42,7 +60,6 @@ public void Should_Execute_Command_Not_Output_Application_Version_To_The_Console
fixture.Configure(configurator =>
{
configurator.SetApplicationVersion("1.0");
-
configurator.AddCommand<EmptyCommand>("empty");
});
@@ -81,7 +98,6 @@ public void Should_Output_Application_Version_To_The_Console_With_Branch_Default
fixture.Configure(configurator =>
{
configurator.SetApplicationVersion("1.0");
-
configurator.AddBranch<EmptyCommandSettings>("branch", branch =>
{
branch.SetDefaultCommand<EmptyCommand>();
|
Built-in parameter `--version` conflicts with existing one
**Information**
- OS: `Windows`
- Version: `Spectre.Console.Cli` v0.49.0
- Terminal: `Windows Terminal / Oh My Posh`
**Describe the bug**
Recent `Spectre.Console.Cli` versions fixed the issue with the new built-in `--version` parameter when _running_ the application, but we can still spot this one when using `--help`. My application is using `--version|-v` for a dedicated usage for years, so I don't want to see nor use the new `Prints version information` in the help menu. Is there a way to remove this ? Thanks !
**To Reproduce**
You can use:
https://github.com/sailro/DependencyPath
https://www.nuget.org/packages/DependencyPath#readme-body-tab
with the following command `dependency-path --help`
**Expected behavior**
I don't want to see a conflicting `--version` parameter with my own.
**Screenshots**

**Additional context**
cc @FrankRay78 unfortunately, this simple little feature seems to be causing so many problems since its introduction.
Thanks !
---
Please upvote :+1: this issue if you are interested in it.
|
Thatβs unfortunate. We should make the ΚΌ-βversionΚΌ option completely opt-in and ensure itβs easy to override the behaviour if wanted.
Iβm not super familiar with the changes that went into this specific addition, but I will take a look tonight and see if we canβt push a 0.49.1 version out that fixes this.
Thank you @patriksvensson , yes I fully agree. Making this `opt-in` would be great. No risk to break existing applications.
|
2024-04-25T17:54:55Z
|
0.1
|
['Spectre.Console.Tests.Unit.Cli.CommandAppTests+Help.Should_Not_Include_Application_Version_If_Not_Set', 'Spectre.Console.Tests.Unit.Cli.CommandAppTests+Help.Should_Include_Application_Version_If_Set', 'Spectre.Console.Tests.Unit.Cli.CommandAppTests+Version.Should_Not_Display_Version_If_Not_Specified']
|
[]
|
spectreconsole/spectre.console
|
spectreconsole__spectre-console-1513
|
eb38f76a6a988acbda3c955a8f6b72083a622bfb
|
diff --git a/src/Spectre.Console/Widgets/Table/TableRenderer.cs b/src/Spectre.Console/Widgets/Table/TableRenderer.cs
index 23bff61cd..0d1716685 100644
--- a/src/Spectre.Console/Widgets/Table/TableRenderer.cs
+++ b/src/Spectre.Console/Widgets/Table/TableRenderer.cs
@@ -150,9 +150,9 @@ public static List<Segment> Render(TableRendererContext context, List<int> colum
result.Add(Segment.LineBreak);
}
- // Show row separator?
+ // Show row separator, if headers are hidden show separator after the first row
if (context.Border.SupportsRowSeparator && context.ShowRowSeparators
- && !isFirstRow && !isLastRow)
+ && (!isFirstRow || (isFirstRow && !context.ShowHeaders)) && !isLastRow)
{
var hasVisibleFootes = context is { ShowFooters: true, HasFooters: true };
var isNextLastLine = index == context.Rows.Count - 2;
|
diff --git a/test/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Row_Separators_No_Header.Output.verified.txt b/test/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Row_Separators_No_Header.Output.verified.txt
new file mode 100644
index 000000000..e296413d0
--- /dev/null
+++ b/test/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Row_Separators_No_Header.Output.verified.txt
@@ -0,0 +1,7 @@
+ο»Ώββββββββββ¬βββββββββ
+β Qux β Corgi β
+ββββββββββΌβββββββββ€
+β Waldo β Grault β
+ββββββββββΌβββββββββ€
+β Garply β Fred β
+ββββββββββ΄βββββββββ
diff --git a/test/Spectre.Console.Tests/Unit/Widgets/Table/TableTests.cs b/test/Spectre.Console.Tests/Unit/Widgets/Table/TableTests.cs
index 9df303846..18379bdcd 100644
--- a/test/Spectre.Console.Tests/Unit/Widgets/Table/TableTests.cs
+++ b/test/Spectre.Console.Tests/Unit/Widgets/Table/TableTests.cs
@@ -159,6 +159,29 @@ public Task Should_Render_Table_With_Row_Separators_Correctly()
return Verifier.Verify(console.Output);
}
+ [Fact]
+ [Expectation("Render_Row_Separators_No_Header")]
+ public Task Should_Render_Table_With_Row_Separators_No_Header_Correctly()
+ {
+ // Given
+ var console = new TestConsole();
+ var table = new Table();
+
+ table.ShowRowSeparators();
+ table.HideHeaders();
+
+ table.AddColumns("Foo", "Bar");
+ table.AddRow("Qux", "Corgi");
+ table.AddRow("Waldo", "Grault");
+ table.AddRow("Garply", "Fred");
+
+ // When
+ console.Write(table);
+
+ // Then
+ return Verifier.Verify(console.Output);
+ }
+
[Fact]
[Expectation("Render_EA_Character")]
public Task Should_Render_Table_With_EA_Character_Correctly()
|
Table line separators not showing for the first line when table headers are hidden
**Information**
- OS: Windows 11 23H2 (OS Build 22631.2506)
- Version: Spectre.Console 0.48.0
- Terminal: Windows Terminal 1.19.3172.0
**Describe the bug**
When table headers are hidden, the first row separator is not drawn.
**To Reproduce**
```csharp
var table = new Table();
table.AddColumn("First");
table.AddColumn("Second");
table.AddRow("1", "2");
table.AddRow("3", "4");
table.AddRow("5", "6");
table.ShowRowSeparators = true;
table.HideHeaders();
AnsiConsole.Write(table);
```
**Expected behavior**
The first row separator should be visible even if table headers are hidden
**Screenshots**

| null |
2024-04-13T15:28:08Z
|
0.1
|
['Spectre.Console.Tests.Unit.TableTests.Should_Render_Table_With_Row_Separators_No_Header_Correctly']
|
[]
|
spectreconsole/spectre.console
|
spectreconsole__spectre-console-1504
|
1a3249cdaea9efa06c25d5e55e4bb53e2a65bedc
|
diff --git a/src/Spectre.Console/Live/LiveRenderable.cs b/src/Spectre.Console/Live/LiveRenderable.cs
index a681d2405..40107f9cd 100644
--- a/src/Spectre.Console/Live/LiveRenderable.cs
+++ b/src/Spectre.Console/Live/LiveRenderable.cs
@@ -49,7 +49,7 @@ public IRenderable PositionCursor()
}
var linesToMoveUp = _shape.Value.Height - 1;
- return new ControlCode("\r" + (EL(2) + CUU(1)).Repeat(linesToMoveUp));
+ return new ControlCode("\r" + CUU(linesToMoveUp));
}
}
|
diff --git a/test/Spectre.Console.Tests/Expectations/Live/Status/Render.Output.verified.txt b/test/Spectre.Console.Tests/Expectations/Live/Status/Render.Output.verified.txt
index cd5fed942..debe2399d 100644
--- a/test/Spectre.Console.Tests/Expectations/Live/Status/Render.Output.verified.txt
+++ b/test/Spectre.Console.Tests/Expectations/Live/Status/Render.Output.verified.txt
@@ -1,10 +1,10 @@
[?25l
[38;5;11m*[0m foo
-[2K[1A[2K[1A
+[2A
[38;5;11m-[0m bar
-[2K[1A[2K[1A
+[2A
[38;5;11m*[0m baz
[2K[1A[2K[1A[2K[?25h
\ No newline at end of file
diff --git a/test/Spectre.Console.Tests/Expectations/Live/Status/WriteLineOverflow.Output.verified.txt b/test/Spectre.Console.Tests/Expectations/Live/Status/WriteLineOverflow.Output.verified.txt
deleted file mode 100644
index d3647bb50..000000000
--- a/test/Spectre.Console.Tests/Expectations/Live/Status/WriteLineOverflow.Output.verified.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-ο»Ώ[?25l
-[38;5;11mβ£·[0m long text that should not interfere writeline text
-
-[2K[1A[2K[1A[38;5;15mxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx[0m
-[38;5;15mxxxxxxxxxx[0m
-
-[38;5;11mβ£·[0m long text that should not interfere writeline text
-
-[2K[1A[2K[1A
-[38;5;11mβ£·[0m long text that should not interfere writeline text
-
-[2K[1A[2K[1A[2K[?25h
\ No newline at end of file
diff --git a/test/Spectre.Console.Tests/Unit/Live/StatusTests.cs b/test/Spectre.Console.Tests/Unit/Live/StatusTests.cs
index b80c5d0d1..a9510ad89 100644
--- a/test/Spectre.Console.Tests/Unit/Live/StatusTests.cs
+++ b/test/Spectre.Console.Tests/Unit/Live/StatusTests.cs
@@ -48,30 +48,4 @@ public Task Should_Render_Status_Correctly()
// Then
return Verifier.Verify(console.Output);
}
-
- [Fact]
- [Expectation("WriteLineOverflow")]
- public Task Should_Render_Correctly_When_WriteLine_Exceeds_Console_Width()
- {
- // Given
- var console = new TestConsole()
- .Colors(ColorSystem.TrueColor)
- .Width(100)
- .Interactive()
- .EmitAnsiSequences();
- var status = new Status(console)
- {
- AutoRefresh = false,
- };
-
- // When
- status.Start("long text that should not interfere writeline text", ctx =>
- {
- ctx.Refresh();
- console.WriteLine("x".Repeat(console.Profile.Width + 10), new Style(foreground: Color.White));
- });
-
- // Then
- return Verifier.Verify(console.Output);
- }
}
|
Blatant flickering
**Information**
- OS: Windows 10/11
- Version: 0.48.0
- Terminal: Dos Prompt, Powershell and Windows Terminal
**Describe the bug**
Displaying a task list with spinners causes the whole task list to flicker. Apparently, see below, this is a regression introduced in 0.48.0
**To Reproduce**
The following code exhibits the issue: (tested on .net 6.0 and .net 8.0)
```c#
using Spectre.Console;
namespace TestConsole
{
internal static class Program
{
private static async Task LoopAsync(ProgressTask task)
{
await Task.Yield();
for (int i = 0; i < 100; i++)
{
task.Increment(1);
await Task.Delay(TimeSpan.FromSeconds(4)).ConfigureAwait(false);
}
}
private static async Task Main()
{
Console.WriteLine("Flickering Test");
var progress = AnsiConsole.Progress()
.AutoRefresh(true)
.AutoClear(false)
.HideCompleted(false)
.Columns(
[
new TaskDescriptionColumn(),
new ProgressBarColumn(),
new PercentageColumn(),
new RemainingTimeColumn(),
new SpinnerColumn(Spinner.Known.Dots),
]);
await progress.StartAsync(async x =>
{
var tasks = new List<Task>();
for (int i = 0; i < 10; i++)
{
var t = x.AddTask($"Task {i}", true, 100);
tasks.Add(LoopAsync(t));
}
await Task.WhenAll(tasks).ConfigureAwait(false);
}).ConfigureAwait(false);
}
}
}
```
**Expected behavior**
No flickering, like in 0.47.0
**Screenshots**
**0.48.0**:

**0.47.0**:

**Additional context**
The "regression" has been introduced in the commit https://github.com/spectreconsole/spectre.console/commit/71a5d830671220e601e4e6ab4d4c352ae0e0a64a
The offending line is in src/Spectre.Console/Live/LiveRenderable.cs:
```diff
- return new ControlCode("\r" + CUU(linesToMoveUp));
+ return new ControlCode("\r" + (EL(2) + CUU(1)).Repeat(linesToMoveUp));
```
|
This is also happening for other widget types in `0.48` including up to at least `0.48.1-preview.0.32` in Windows terminal
https://github.com/spectreconsole/spectre.console/assets/13159458/f2783bb7-08c5-49cd-a097-4bc06e78bea5
This happens in progress displays without spinners as well.
Can confirm what @yenneferofvengerberg posted, rolling back that commit related to long lines smooths things out again.
Probably need something a bit more clever than brute forcing a clear on each line each render. I'd almost be inclined to suggest using the `RenderHook` that now exists on `LiveRenderables` as the mechanism for including extra info while a progress is running rather than write line. Gives us a bit more control over the whole process too
Is there a PR to roll this back?
I considered doing it, but I couldn't figure out how to maintain the
correct behavior when the text goes out of screen. If someone can provide
me a hint, I would be happy to try
Since it's a regression I would say that it's OK with restoring it how it was, and look at finding a solution for it later.
|
2024-04-01T15:38:29Z
|
0.1
|
[]
|
['Spectre.Console.Tests.Unit.StatusTests.Should_Render_Status_Correctly']
|
spectreconsole/spectre.console
|
spectreconsole__spectre-console-1503
|
43f9ae92adf36dd5cb96add90d74f867690c3ed3
|
diff --git a/src/Spectre.Console.Cli/Internal/Commands/XmlDocCommand.cs b/src/Spectre.Console.Cli/Internal/Commands/XmlDocCommand.cs
index 807251833..7b7592ca8 100644
--- a/src/Spectre.Console.Cli/Internal/Commands/XmlDocCommand.cs
+++ b/src/Spectre.Console.Cli/Internal/Commands/XmlDocCommand.cs
@@ -84,6 +84,13 @@ private static XmlNode CreateCommandNode(XmlDocument doc, CommandInfo command, b
node.SetNullableAttribute("Settings", command.SettingsType?.FullName);
+ if (!string.IsNullOrWhiteSpace(command.Description))
+ {
+ var descriptionNode = doc.CreateElement("Description");
+ descriptionNode.InnerText = command.Description;
+ node.AppendChild(descriptionNode);
+ }
+
// Parameters
if (command.Parameters.Count > 0)
{
@@ -103,6 +110,27 @@ private static XmlNode CreateCommandNode(XmlDocument doc, CommandInfo command, b
node.AppendChild(CreateCommandNode(doc, childCommand));
}
+ // Examples
+ if (command.Examples.Count > 0)
+ {
+ var exampleRootNode = doc.CreateElement("Examples");
+ foreach (var example in command.Examples.SelectMany(static x => x))
+ {
+ var exampleNode = CreateExampleNode(doc, example);
+ exampleRootNode.AppendChild(exampleNode);
+ }
+
+ node.AppendChild(exampleRootNode);
+ }
+
+ return node;
+ }
+
+ private static XmlNode CreateExampleNode(XmlDocument document, string example)
+ {
+ var node = document.CreateElement("Example");
+ node.SetAttribute("commandLine", example);
+
return node;
}
|
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_1.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_1.Output.verified.txt
index 998a89b3a..e92f683de 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_1.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_1.Output.verified.txt
@@ -21,6 +21,7 @@
</Parameters>
<!--DOG-->
<Command Name="dog" IsBranch="false" ClrType="Spectre.Console.Tests.Data.DogCommand" Settings="Spectre.Console.Tests.Data.DogSettings">
+ <Description>The dog command.</Description>
<Parameters>
<Argument Name="AGE" Position="0" Required="true" Kind="scalar" ClrType="System.Int32" />
<Option Short="g" Long="good-boy" Value="NULL" Required="false" Kind="flag" ClrType="System.Boolean" />
@@ -28,6 +29,7 @@
</Command>
<!--HORSE-->
<Command Name="horse" IsBranch="false" ClrType="Spectre.Console.Tests.Data.HorseCommand" Settings="Spectre.Console.Tests.Data.HorseSettings">
+ <Description>The horse command.</Description>
<Parameters>
<Option Short="d" Long="day" Value="MON|TUE" Required="false" Kind="scalar" ClrType="System.DayOfWeek" />
<Option Short="" Long="directory" Value="NULL" Required="false" Kind="scalar" ClrType="System.IO.DirectoryInfo" />
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_10.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_10.Output.verified.txt
new file mode 100644
index 000000000..2c89d04a7
--- /dev/null
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_10.Output.verified.txt
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Model>
+ <!--DOG-->
+ <Command Name="dog" IsBranch="false" ClrType="Spectre.Console.Tests.Data.DogCommand" Settings="Spectre.Console.Tests.Data.DogSettings">
+ <Description>The dog command.</Description>
+ <Parameters>
+ <Argument Name="LEGS" Position="0" Required="false" Kind="scalar" ClrType="System.Int32">
+ <Description>The number of legs.</Description>
+ <Validators>
+ <Validator ClrType="Spectre.Console.Tests.Data.EvenNumberValidatorAttribute" Message="Animals must have an even number of legs." />
+ <Validator ClrType="Spectre.Console.Tests.Data.PositiveNumberValidatorAttribute" Message="Number of legs must be greater than 0." />
+ </Validators>
+ </Argument>
+ <Argument Name="AGE" Position="1" Required="true" Kind="scalar" ClrType="System.Int32" />
+ <Option Short="a" Long="alive,not-dead" Value="NULL" Required="false" Kind="flag" ClrType="System.Boolean">
+ <Description>Indicates whether or not the animal is alive.</Description>
+ </Option>
+ <Option Short="g" Long="good-boy" Value="NULL" Required="false" Kind="flag" ClrType="System.Boolean" />
+ <Option Short="n,p" Long="name,pet-name" Value="VALUE" Required="false" Kind="scalar" ClrType="System.String" />
+ </Parameters>
+ <Examples>
+ <Example commandLine="dog -g" />
+ <Example commandLine="dog --good-boy" />
+ </Examples>
+ </Command>
+</Model>
\ No newline at end of file
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_2.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_2.Output.verified.txt
index 9f3463020..29098b822 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_2.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_2.Output.verified.txt
@@ -2,6 +2,7 @@
<Model>
<!--DOG-->
<Command Name="dog" IsBranch="false" ClrType="Spectre.Console.Tests.Data.DogCommand" Settings="Spectre.Console.Tests.Data.DogSettings">
+ <Description>The dog command.</Description>
<Parameters>
<Argument Name="LEGS" Position="0" Required="false" Kind="scalar" ClrType="System.Int32">
<Description>The number of legs.</Description>
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_3.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_3.Output.verified.txt
index 6b1f90fba..ffb491802 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_3.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_3.Output.verified.txt
@@ -16,6 +16,7 @@
</Parameters>
<!--DOG-->
<Command Name="dog" IsBranch="false" ClrType="Spectre.Console.Tests.Data.DogCommand" Settings="Spectre.Console.Tests.Data.DogSettings">
+ <Description>The dog command.</Description>
<Parameters>
<Argument Name="AGE" Position="0" Required="true" Kind="scalar" ClrType="System.Int32" />
<Option Short="g" Long="good-boy" Value="NULL" Required="false" Kind="flag" ClrType="System.Boolean" />
@@ -24,6 +25,7 @@
</Command>
<!--HORSE-->
<Command Name="horse" IsBranch="false" ClrType="Spectre.Console.Tests.Data.HorseCommand" Settings="Spectre.Console.Tests.Data.HorseSettings">
+ <Description>The horse command.</Description>
<Parameters>
<Option Short="d" Long="day" Value="MON|TUE" Required="false" Kind="scalar" ClrType="System.DayOfWeek" />
<Option Short="" Long="directory" Value="NULL" Required="false" Kind="scalar" ClrType="System.IO.DirectoryInfo" />
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_4.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_4.Output.verified.txt
index 594918922..07b9dcd35 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_4.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_4.Output.verified.txt
@@ -16,6 +16,7 @@
</Parameters>
<!--DOG-->
<Command Name="dog" IsBranch="false" ClrType="Spectre.Console.Tests.Data.DogCommand" Settings="Spectre.Console.Tests.Data.DogSettings">
+ <Description>The dog command.</Description>
<Parameters>
<Argument Name="AGE" Position="0" Required="true" Kind="scalar" ClrType="System.Int32" />
<Option Short="g" Long="good-boy" Value="NULL" Required="false" Kind="flag" ClrType="System.Boolean" />
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_6.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_6.Output.verified.txt
index 0907636ae..92b2aba93 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_6.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_6.Output.verified.txt
@@ -2,6 +2,7 @@
<Model>
<!--DEFAULT COMMAND-->
<Command Name="__default_command" IsBranch="false" IsDefault="true" ClrType="Spectre.Console.Tests.Data.DogCommand" Settings="Spectre.Console.Tests.Data.DogSettings">
+ <Description>The dog command.</Description>
<Parameters>
<Argument Name="LEGS" Position="0" Required="false" Kind="scalar" ClrType="System.Int32">
<Description>The number of legs.</Description>
@@ -20,6 +21,7 @@
</Command>
<!--HORSE-->
<Command Name="horse" IsBranch="false" ClrType="Spectre.Console.Tests.Data.HorseCommand" Settings="Spectre.Console.Tests.Data.HorseSettings">
+ <Description>The horse command.</Description>
<Parameters>
<Argument Name="LEGS" Position="0" Required="false" Kind="scalar" ClrType="System.Int32">
<Description>The number of legs.</Description>
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_7.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_7.Output.verified.txt
index 46ae6a82a..69699701d 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_7.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_7.Output.verified.txt
@@ -21,6 +21,7 @@
</Parameters>
<!--__DEFAULT_COMMAND-->
<Command Name="__default_command" IsBranch="false" ClrType="Spectre.Console.Tests.Data.HorseCommand" Settings="Spectre.Console.Tests.Data.HorseSettings">
+ <Description>The horse command.</Description>
<Parameters>
<Option Short="d" Long="day" Value="MON|TUE" Required="false" Kind="scalar" ClrType="System.DayOfWeek" />
<Option Short="" Long="directory" Value="NULL" Required="false" Kind="scalar" ClrType="System.IO.DirectoryInfo" />
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_8.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_8.Output.verified.txt
index 3f836ae57..5ccfbd01a 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_8.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_8.Output.verified.txt
@@ -16,6 +16,7 @@
</Parameters>
<!--DOG-->
<Command Name="dog" IsBranch="false" ClrType="Spectre.Console.Tests.Data.DogCommand" Settings="Spectre.Console.Tests.Data.DogSettings">
+ <Description>The dog command.</Description>
<Parameters>
<Argument Name="AGE" Position="0" Required="true" Kind="scalar" ClrType="System.Int32" />
<Option Short="g" Long="good-boy" Value="NULL" Required="false" Kind="flag" ClrType="System.Boolean" />
@@ -24,6 +25,7 @@
</Command>
<!--__DEFAULT_COMMAND-->
<Command Name="__default_command" IsBranch="false" ClrType="Spectre.Console.Tests.Data.HorseCommand" Settings="Spectre.Console.Tests.Data.HorseSettings">
+ <Description>The horse command.</Description>
<Parameters>
<Option Short="d" Long="day" Value="MON|TUE" Required="false" Kind="scalar" ClrType="System.DayOfWeek" />
<Option Short="" Long="directory" Value="NULL" Required="false" Kind="scalar" ClrType="System.IO.DirectoryInfo" />
diff --git a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_9.Output.verified.txt b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_9.Output.verified.txt
index 5549f5dcf..7c2396bb0 100644
--- a/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_9.Output.verified.txt
+++ b/test/Spectre.Console.Cli.Tests/Expectations/Xml/Test_9.Output.verified.txt
@@ -18,6 +18,7 @@
</Parameters>
<!--DOG-->
<Command Name="dog" IsBranch="false" ClrType="Spectre.Console.Tests.Data.DogCommand" Settings="Spectre.Console.Tests.Data.DogSettings">
+ <Description>The dog command.</Description>
<Parameters>
<Argument Name="AGE" Position="0" Required="true" Kind="scalar" ClrType="System.Int32" />
<Option Short="g" Long="good-boy" Value="NULL" Required="false" Kind="flag" ClrType="System.Boolean" />
@@ -26,6 +27,7 @@
</Command>
<!--__DEFAULT_COMMAND-->
<Command Name="__default_command" IsBranch="false" ClrType="Spectre.Console.Tests.Data.HorseCommand" Settings="Spectre.Console.Tests.Data.HorseSettings">
+ <Description>The horse command.</Description>
<Parameters>
<Option Short="d" Long="day" Value="MON|TUE" Required="false" Kind="scalar" ClrType="System.DayOfWeek" />
<Option Short="" Long="directory" Value="NULL" Required="false" Kind="scalar" ClrType="System.IO.DirectoryInfo" />
diff --git a/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Xml.cs b/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Xml.cs
index 1ed1b4152..8a6348b9e 100644
--- a/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Xml.cs
+++ b/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Xml.cs
@@ -110,6 +110,26 @@ public Task Should_Dump_Correct_Model_For_Case_5()
return Verifier.Verify(result.Output);
}
+ [Fact]
+ [Expectation("Test_10")]
+ public Task Should_Dump_Correct_Model_For_Case_6()
+ {
+ // Given
+ var fixture = new CommandAppTester();
+ fixture.Configure(config =>
+ {
+ config.AddCommand<DogCommand>("dog")
+ .WithExample("dog -g")
+ .WithExample("dog --good-boy");
+ });
+
+ // When
+ var result = fixture.Run(Constants.XmlDocCommand);
+
+ // Then
+ return Verifier.Verify(result.Output);
+ }
+
[Fact]
[Expectation("Test_6")]
public Task Should_Dump_Correct_Model_For_Model_With_Default_Command()
|
Export for Documentation
I'm currently manually creating the documentation to put on my site for the CLI usage. Which gave me a thought...
Would it be possible to do some sort of export of the the documentation.
If I have branch commands I have to go into each command and call `-h` to get the output for that command, then I use that to build the documentation on the site.
I have no idea how you would solve it nicely, maybe a nuget tool which analysis it and generates a .md file.
Feel free to close this is my idea is stupid...
|
A little hidden gem of Spectre.Console.Cli is that you can export XML structure with a hidden command.
Try passing `cli xmldoc` to your application and it should give you the XML structure:
<img width="776" alt="image" src="https://user-images.githubusercontent.com/357872/208904802-44228d2a-1dd1-4cf7-b7a2-47d298ddce7f.png">
You can use this XML to generate documentation for your app.
Other than lacking Description and Examples, this is awesome!
`explain` is really nice for being able to view the branches and check that descriptions and examples have been written.
We could add description and examples to the xmldoc output.
I don't mind trying to do a PR next week if you can point me in the right direction.
@phillip-haydon The command you would want to extend is the `XmlDocCommand` which can be found here: https://github.com/spectreconsole/spectre.console/blob/main/src/Spectre.Console.Cli/Internal/Commands/XmlDocCommand.cs
> I don't mind trying to do a PR next week if you can point me in the right direction.
Still interested in preparing a PR for this @phillip-haydon? If so, I can make myself available to review with a view to merging.
Hey, would still love this, no time at the moment :(.
|
2024-03-29T19:09:10Z
|
0.1
|
['Spectre.Console.Tests.Unit.Cli.CommandAppTests+Xml.Should_Dump_Correct_Model_For_Case_6']
|
[]
|
spectreconsole/spectre.console
|
spectreconsole__spectre-console-1458
|
72704529c5ac45401eee0b61ddd6cbaba9baab22
|
diff --git a/src/Spectre.Console/Extensions/AnsiConsoleExtensions.Input.cs b/src/Spectre.Console/Extensions/AnsiConsoleExtensions.Input.cs
index f5299adde..7769e33a5 100644
--- a/src/Spectre.Console/Extensions/AnsiConsoleExtensions.Input.cs
+++ b/src/Spectre.Console/Extensions/AnsiConsoleExtensions.Input.cs
@@ -53,7 +53,11 @@ internal static async Task<string> ReadLine(this IAnsiConsole console, Style? st
if (text.Length > 0)
{
text = text.Substring(0, text.Length - 1);
- console.Write("\b \b");
+
+ if (mask != null)
+ {
+ console.Write("\b \b");
+ }
}
continue;
|
diff --git a/test/Spectre.Console.Tests/Expectations/Prompts/Text/SecretValueBackspaceNullMask.Output.verified.txt b/test/Spectre.Console.Tests/Expectations/Prompts/Text/SecretValueBackspaceNullMask.Output.verified.txt
new file mode 100644
index 000000000..473c6d87b
--- /dev/null
+++ b/test/Spectre.Console.Tests/Expectations/Prompts/Text/SecretValueBackspaceNullMask.Output.verified.txt
@@ -0,0 +1,1 @@
+ο»ΏFavorite fruit?
diff --git a/test/Spectre.Console.Tests/Unit/Prompts/TextPromptTests.cs b/test/Spectre.Console.Tests/Unit/Prompts/TextPromptTests.cs
index 52d26e7d5..c358b9be3 100644
--- a/test/Spectre.Console.Tests/Unit/Prompts/TextPromptTests.cs
+++ b/test/Spectre.Console.Tests/Unit/Prompts/TextPromptTests.cs
@@ -248,6 +248,25 @@ public Task Should_Choose_Masked_Default_Value_If_Nothing_Is_Entered_And_Prompt_
return Verifier.Verify(console.Output);
}
+ [Fact]
+ [Expectation("SecretValueBackspaceNullMask")]
+ public Task Should_Not_Erase_Prompt_Text_On_Backspace_If_Prompt_Is_Secret_And_Mask_Is_Null()
+ {
+ // Given
+ var console = new TestConsole();
+ console.Input.PushText("Bananas");
+ console.Input.PushKey(ConsoleKey.Backspace);
+ console.Input.PushKey(ConsoleKey.Enter);
+
+ // When
+ console.Prompt(
+ new TextPrompt<string>("Favorite fruit?")
+ .Secret(null));
+
+ // Then
+ return Verifier.Verify(console.Output);
+ }
+
[Fact]
[Expectation("SecretDefaultValueCustomMask")]
public Task Should_Choose_Custom_Masked_Default_Value_If_Nothing_Is_Entered_And_Prompt_Is_Secret_And_Mask_Is_Custom()
|
Prompt text is erased upon backspace when the prompt text is a secret and its mask is null.
**Describe the bug**
Prompt text is erased upon backspace when the prompt text is a secret and its mask is null.
**To Reproduce**
Create secret Prompt with a null mask. Show the Prompt. Enter a few characters, then backspace. The prompt text will be deleted.
**Expected behavior**
Prompt text deletion should stop after the ultimate character of the prompt text.
| null |
2024-02-12T20:05:19Z
|
0.1
|
['Spectre.Console.Tests.Unit.TextPromptTests.Should_Not_Erase_Prompt_Text_On_Backspace_If_Prompt_Is_Secret_And_Mask_Is_Null']
|
[]
|
spectreconsole/spectre.console
|
spectreconsole__spectre-console-1338
|
e2a674815dcbe9589cc87723dd6410f64aaff682
|
diff --git a/src/Spectre.Console/Widgets/Rows.cs b/src/Spectre.Console/Widgets/Rows.cs
index 8e3e59576..91c963f03 100644
--- a/src/Spectre.Console/Widgets/Rows.cs
+++ b/src/Spectre.Console/Widgets/Rows.cs
@@ -41,8 +41,8 @@ protected override Measurement Measure(RenderOptions options, int maxWidth)
if (measurements.Length > 0)
{
return new Measurement(
- measurements.Min(c => c.Min),
- measurements.Min(c => c.Max));
+ measurements.Max(c => c.Min),
+ measurements.Max(c => c.Max));
}
return new Measurement(0, 0);
|
diff --git a/test/Spectre.Console.Tests/Expectations/Widgets/Rows/GH-1188-Rows.Output.verified.txt b/test/Spectre.Console.Tests/Expectations/Widgets/Rows/GH-1188-Rows.Output.verified.txt
new file mode 100644
index 000000000..ed5efe628
--- /dev/null
+++ b/test/Spectre.Console.Tests/Expectations/Widgets/Rows/GH-1188-Rows.Output.verified.txt
@@ -0,0 +1,5 @@
+ο»Ώβββββββ
+β 1 β
+β 22 β
+β 333 β
+βββββββ
diff --git a/test/Spectre.Console.Tests/Unit/Widgets/RowsTests.cs b/test/Spectre.Console.Tests/Unit/Widgets/RowsTests.cs
index 9d95e64bf..6937d842f 100644
--- a/test/Spectre.Console.Tests/Unit/Widgets/RowsTests.cs
+++ b/test/Spectre.Console.Tests/Unit/Widgets/RowsTests.cs
@@ -4,6 +4,29 @@ namespace Spectre.Console.Tests.Unit;
[ExpectationPath("Widgets/Rows")]
public sealed class RowsTests
{
+ [Fact]
+ [Expectation("GH-1188-Rows")]
+ [GitHubIssue("https://github.com/spectreconsole/spectre.console/issues/1188")]
+ public Task Should_Render_Rows_In_Panel_Without_Breaking_Lines()
+ {
+ // Given
+ var console = new TestConsole().Width(60);
+ var rows = new Rows(
+ new IRenderable[]
+ {
+ new Text("1"),
+ new Text("22"),
+ new Text("333"),
+ });
+ var panel = new Panel(rows);
+
+ // When
+ console.Write(panel);
+
+ // Then
+ return Verifier.Verify(console.Output);
+ }
+
[Fact]
[Expectation("Render")]
public Task Should_Render_Rows()
|
Rows sizing is inconsistent
**Information**
- OS: Windows
- Version: 0.46
- Terminal: Powershell, Windows Rider Integrated Terminal
**Describe the bug**
Sizing of `Panel` is confusing and buggy:
- There's no way to make the panel fit its contents. Instead, it expands the full width of the terminal (which looks ugly)
- Depending on the content I put in it, the size behavior changes.
**To Reproduce**
See MCVE:
```cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Spectre.Console;
using Spectre.Console.Cli;
using Spectre.Console.Rendering;
namespace ConsoleApp1;
public enum SupportedServices { Radarr, Sonarr }
public record MyConfig(string InstanceName, SupportedServices Service);
public class ConfigLocalLister : Command<ConfigLocalLister.CliSettings>
{
public class CliSettings : CommandSettings
{
}
private readonly IAnsiConsole _console;
public ConfigLocalLister(IAnsiConsole console)
{
_console = console;
}
private void List()
{
var appDataDir = @"C:\appDataDir";
var tree = new Tree(appDataDir);
var configsDict = new Dictionary<string, MyConfig[]>
{
{
"radarr.yml", new[]
{
new MyConfig("instance1", SupportedServices.Radarr),
}
},
{
"sonarr.yml", new[]
{
new MyConfig("instance2", SupportedServices.Sonarr),
new MyConfig("instance3", SupportedServices.Sonarr),
}
},
{
"both.yml", new[]
{
new MyConfig("instance4", SupportedServices.Radarr),
new MyConfig("instance5", SupportedServices.Radarr),
new MyConfig("instance6", SupportedServices.Sonarr),
new MyConfig("instance7", SupportedServices.Sonarr),
}
},
};
foreach (var configPath in configsDict.Keys)
{
var configs = configsDict[configPath];
var rows = new List<IRenderable>();
BuildInstanceTree(rows, configs, SupportedServices.Radarr);
BuildInstanceTree(rows, configs, SupportedServices.Sonarr);
if (!rows.Any())
{
rows.Add(new Markup("([red]Empty[/])"));
}
var rowsWidget = new Rows(rows);
var panel = new Panel(rowsWidget)
.Header(configPath);
tree.AddNode(panel);
}
_console.WriteLine();
_console.Write(tree);
}
private static void BuildInstanceTree(
ICollection<IRenderable> rows,
MyConfig[] registry,
SupportedServices service)
{
var configs = registry.Where(x => x.Service == service).ToList();
if (!configs.Any())
{
return;
}
var tree = new Tree(service.ToString());
tree.AddNodes(configs.Select(c =>
Markup.FromInterpolated($"[blue]{c.InstanceName}[/]")));
if (rows.Any())
{
// This causes the size of the panel to adjust to the length of this line
rows.Add(new Text("---------------------------"));
}
rows.Add(tree);
}
public override int Execute(CommandContext context, CliSettings settings)
{
List();
return 0;
}
}
public static class Program
{
public static void Main(string[] args)
{
var app = new CommandApp();
app.Configure(c =>
{
c.AddCommand<ConfigLocalLister>("list");
});
app.Run(args);
}
}
```
**Expected behavior**
1. There should be a way to tell the panel to fit its contents
2. The third panel in the tree is sized inconsistently; the inconsistency is the bug but I don't know what the actual expected sizing behavior is.
**Screenshots**

| null |
2023-10-19T06:01:54Z
|
0.1
|
['Spectre.Console.Tests.Unit.RowsTests.Should_Render_Rows_In_Panel_Without_Breaking_Lines']
|
[]
|
spectreconsole/spectre.console
|
spectreconsole__spectre-console-1308
|
2af3f7faeb0f5b89e48670af1b15619b3693388f
|
diff --git a/src/Spectre.Console/Widgets/TextPath.cs b/src/Spectre.Console/Widgets/TextPath.cs
index db5eafc7e..fafafb7b1 100644
--- a/src/Spectre.Console/Widgets/TextPath.cs
+++ b/src/Spectre.Console/Widgets/TextPath.cs
@@ -74,7 +74,7 @@ public Measurement Measure(RenderOptions options, int maxWidth)
return new Measurement(
Math.Min(length, maxWidth),
- Math.Max(length, maxWidth));
+ Math.Min(length, maxWidth));
}
/// <inheritdoc/>
@@ -119,9 +119,6 @@ public IEnumerable<Segment> Render(RenderOptions options, int maxWidth)
// Align the result
Aligner.Align(parts, Justification, maxWidth);
- // Insert a line break
- parts.Add(Segment.LineBreak);
-
return parts;
}
@@ -134,7 +131,7 @@ private string[] Fit(RenderOptions options, int maxWidth)
}
// Will it fit as is?
- if (_parts.Sum(p => Cell.GetCellLength(p)) + (_parts.Length - 1) < maxWidth)
+ if (_parts.Sum(Cell.GetCellLength) + (_parts.Length - 1) <= maxWidth)
{
return _parts;
}
@@ -159,7 +156,7 @@ private string[] Fit(RenderOptions options, int maxWidth)
var queueWidth =
rootLength // Root (if rooted)
+ ellipsisLength // Ellipsis
- + queue.Sum(p => Cell.GetCellLength(p)) // Middle
+ + queue.Sum(Cell.GetCellLength) // Middle
+ Cell.GetCellLength(_parts.Last()) // Last
+ queue.Count + separatorCount; // Separators
|
diff --git a/test/Spectre.Console.Tests/Expectations/Widgets/TextPath/GH-1307.Output.verified.txt b/test/Spectre.Console.Tests/Expectations/Widgets/TextPath/GH-1307.Output.verified.txt
new file mode 100644
index 000000000..06cfb5f27
--- /dev/null
+++ b/test/Spectre.Console.Tests/Expectations/Widgets/TextPath/GH-1307.Output.verified.txt
@@ -0,0 +1,3 @@
+ο»Ώβββββββ βββββββ
+β Baz β β Qux β
+βββββββ βββββββ
diff --git a/test/Spectre.Console.Tests/Unit/Widgets/TextPathTests.cs b/test/Spectre.Console.Tests/Unit/Widgets/TextPathTests.cs
index d7e5513c7..0dda74206 100644
--- a/test/Spectre.Console.Tests/Unit/Widgets/TextPathTests.cs
+++ b/test/Spectre.Console.Tests/Unit/Widgets/TextPathTests.cs
@@ -1,5 +1,7 @@
namespace Spectre.Console.Tests.Unit;
+[UsesVerify]
+[ExpectationPath("Widgets/TextPath")]
public sealed class TextPathTests
{
[Theory]
@@ -14,8 +16,7 @@ public void Should_Use_Last_Segments_If_Less_Than_Three(int width, string input,
console.Write(new TextPath(input));
// Then
- console.Output.TrimEnd()
- .ShouldBe(expected);
+ console.Output.ShouldBe(expected);
}
[Theory]
@@ -31,8 +32,7 @@ public void Should_Render_Full_Path_If_Possible(string input, string expected)
console.Write(new TextPath(input));
// Then
- console.Output.TrimEnd()
- .ShouldBe(expected);
+ console.Output.ShouldBe(expected);
}
[Theory]
@@ -48,53 +48,50 @@ public void Should_Pop_Segments_From_Left(int width, string input, string expect
console.Write(new TextPath(input));
// Then
- console.Output.TrimEnd()
- .ShouldBe(expected);
+ console.Output.ShouldBe(expected);
}
- [Theory]
- [InlineData("C:/My documents/Bar/Baz.txt")]
- [InlineData("/My documents/Bar/Baz.txt")]
- [InlineData("My documents/Bar/Baz.txt")]
- [InlineData("Bar/Baz.txt")]
- [InlineData("Baz.txt")]
- public void Should_Insert_Line_Break_At_End_Of_Path(string input)
+ [Fact]
+ public void Should_Right_Align_Correctly()
{
// Given
- var console = new TestConsole().Width(80);
+ var console = new TestConsole().Width(40);
// When
- console.Write(new TextPath(input));
+ console.Write(new TextPath("C:/My documents/Bar/Baz.txt").RightJustified());
// Then
- console.Output.ShouldEndWith("\n");
+ console.Output.ShouldBe(" C:/My documents/Bar/Baz.txt");
}
[Fact]
- public void Should_Right_Align_Correctly()
+ public void Should_Center_Align_Correctly()
{
// Given
var console = new TestConsole().Width(40);
// When
- console.Write(new TextPath("C:/My documents/Bar/Baz.txt").RightJustified());
+ console.Write(new TextPath("C:/My documents/Bar/Baz.txt").Centered());
// Then
- console.Output.TrimEnd('\n')
- .ShouldBe(" C:/My documents/Bar/Baz.txt");
+ console.Output.ShouldBe(" C:/My documents/Bar/Baz.txt ");
}
[Fact]
- public void Should_Center_Align_Correctly()
+ [Expectation("GH-1307")]
+ [GitHubIssue("https://github.com/spectreconsole/spectre.console/issues/1307")]
+ public Task Should_Behave_As_Expected_When_Rendering_Inside_Panel_Columns()
{
// Given
var console = new TestConsole().Width(40);
// When
- console.Write(new TextPath("C:/My documents/Bar/Baz.txt").Centered());
+ console.Write(
+ new Columns(
+ new Panel(new Text("Baz")),
+ new Panel(new TextPath("Qux"))));
// Then
- console.Output.TrimEnd('\n')
- .ShouldBe(" C:/My documents/Bar/Baz.txt ");
+ return Verifier.Verify(console.Output);
}
}
diff --git a/test/Spectre.Console.Tests/Utilities/GitHubIssueAttribute.cs b/test/Spectre.Console.Tests/Utilities/GitHubIssueAttribute.cs
new file mode 100644
index 000000000..d7d30a7c6
--- /dev/null
+++ b/test/Spectre.Console.Tests/Utilities/GitHubIssueAttribute.cs
@@ -0,0 +1,12 @@
+ο»Ώnamespace Spectre.Console.Tests;
+
+[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
+public sealed class GitHubIssueAttribute : Attribute
+{
+ public string Url { get; }
+
+ public GitHubIssueAttribute(string url)
+ {
+ Url = url;
+ }
+}
\ No newline at end of file
|
TextPath behaves strange together with columns
**Information**
- OS: Windows
- Version: 0.47.0
- Terminal: Windows Terminal
**Describe the bug**
TextPath seems to add a new line and/or being greedy about the max size.
**To Reproduce**
```csharp
// Works as expected
AnsiConsole.Write(
new Columns(
new Panel(new Text("Foo")),
new Panel(new Text("Bar"))
));
// Does not work as expected
AnsiConsole.Write(
new Columns(
new Panel(new Text("Baz")),
new Panel(new TextPath("Qux"))
).Collapse());
```
**Expected behavior**
The bottom example in the reproduction should look like the top one.
**Screenshots**
<img width="667" alt="image" src="https://github.com/spectreconsole/spectre.console/assets/357872/3cfaa951-c0c1-4405-bfd2-7fa35344326d">
| null |
2023-09-17T22:08:56Z
|
0.1
|
['Spectre.Console.Tests.Unit.TextPathTests.Should_Behave_As_Expected_When_Rendering_Inside_Panel_Columns']
|
[]
|
End of preview. Expand
in Data Studio
SWE-Sharp-Bench
SWE-Sharp-Bench is a comprehensive benchmark suite for evaluating software engineering capabilities of AI agents and models on C# and .NET codebases. This benchmark extends the SWE-Bench framework to the C# ecosystem, providing real-world software engineering tasks from popular open-source repositories.
Code - https://github.com/microsoft/prose/tree/main/misc/SWE-Sharp-Bench
Research Paper Draft & Benchmark Analysis: https://aka.ms/swesharparxiv
Contact
If you have suggestions or any questions, please raise an issue on Github or contact us at [email protected] .
Citation
If you find our work helpful for your research, please consider citing our work.
@misc{mhatre2025swesharpbenchreproduciblebenchmarkc,
title={SWE-Sharp-Bench: A Reproducible Benchmark for C# Software Engineering Tasks},
author={Sanket Mhatre and Yasharth Bajpai and Sumit Gulwani and Emerson Murphy-Hill and Gustavo Soares},
year={2025},
eprint={2511.02352},
archivePrefix={arXiv},
primaryClass={cs.SE},
url={https://arxiv.org/abs/2511.02352},
}
- Downloads last month
- 117